Skip to content

Instantly share code, notes, and snippets.

@jpmckinney
Last active August 29, 2015 14:21
Show Gist options
  • Save jpmckinney/1ad22481edfb494feab0 to your computer and use it in GitHub Desktop.
Save jpmckinney/1ad22481edfb494feab0 to your computer and use it in GitHub Desktop.
Polymaps example
<!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