Last active
August 29, 2015 14:21
-
-
Save jpmckinney/1ad22481edfb494feab0 to your computer and use it in GitHub Desktop.
Polymaps example
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 class="no-js" lang=""> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="x-ua-compatible" content="ie=edge"> | |
<title>Test</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body> | |
<div id="map"> | |
</div> | |
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/polymaps/2.5.1/polymaps.min.js"></script> | |
<script> | |
var po = org.polymaps; | |
var map = po.map() | |
.container(document.getElementById("map").appendChild(po.svg("svg"))) | |
.add(po.interact()) | |
.center({lat: 0, lon: 0}) | |
.zoom(1); | |
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.", ""]))); | |
$.getJSON('http://0.0.0.0:9292/countries', function (countries) { | |
map.add(po.geoJson().features(countries)); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment