This example is a simple loupe using Polymaps. Drag the center of the loupe to move it around, or drag the thick border to resize it. Loupes are normally used to magnify, showing focus and context, but in this example we're using it to show two different tilesets. You can enable magnification (or minification) using the zoomDelta
property.
Last active
February 8, 2016 23:03
Loupe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript" src="https://cdn.rawgit.com/simplegeo/polymaps/v2.2.0/polymaps.min.js"></script> | |
<script type="text/javascript" src="https://cdn.rawgit.com/mbostock/polymaps/30a15c8165afc55a43df54779c232f3e5f8ee544/examples/loupe/loupe.js"></script> | |
<style type="text/css"> | |
@import url("https://cdn.rawgit.com/simplegeo/polymaps/v2.2.0/examples/example.css"); | |
html, body { | |
height: 100%; | |
} | |
svg { | |
display: block; | |
} | |
.loupe .back { | |
stroke: #000; | |
stroke-width: 8px; | |
} | |
.loupe .fore { | |
stroke: #E5E0D9; | |
stroke-width: 6px; | |
} | |
</style> | |
</head> | |
<body id="map"> | |
<script type="text/javascript"> | |
var po = org.polymaps; | |
var map = po.map() | |
.container(document.getElementById("map").appendChild(po.svg("svg"))) | |
.add(po.interact()) | |
.add(po.hash()); | |
map.add(po.image() | |
.url(po.url("http://{S}tile.cloudmade.com" | |
+ "/1a1b06b230af4efdbb989ea99e9841af" // http://cloudmade.com/register | |
+ "/998/256/{Z}/{X}/{Y}.png") | |
.hosts(["a.", "b.", "c.", ""]))); | |
map.add(po.loupe() | |
.add(po.image() | |
.url(po.url("http://{S}tile.cloudmade.com" | |
+ "/1a1b06b230af4efdbb989ea99e9841af" // http://cloudmade.com/register | |
+ "/999/256/{Z}/{X}/{Y}.png") | |
.hosts(["a.", "b.", "c.", ""])))); | |
map.add(po.compass() | |
.pan("none")); | |
</script> | |
<span id="copy"> | |
© 2010 | |
<a href="http://www.cloudmade.com/">CloudMade</a>, | |
<a href="http://www.openstreetmap.org/">OpenStreetMap</a> contributors, | |
<a href="http://creativecommons.org/licenses/by-sa/2.0/">CCBYSA</a>. | |
</span> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment