Skip to content

Instantly share code, notes, and snippets.

@mager
Created September 29, 2010 16:21
Show Gist options
  • Save mager/603043 to your computer and use it in GitHub Desktop.
Save mager/603043 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Nick Jaffe's Polymap</title>
<script type="text/javascript" src="http://github.com/simplegeo/polymaps/raw/v2.2.0/lib/protovis/protodata.js"></script>
<script type="text/javascript" src="http://github.com/simplegeo/polymaps/raw/v2.2.0/polymaps.js"></script>
<style type="text/css">
@import url("http://github.com/simplegeo/polymaps/raw/v2.2.0/examples/example.css");
#contours path {
fill: none;
stroke: #E34A33;
stroke-linecap: round;
stroke-width: 1.5px;
stroke-opacity: 0.7;
vector-effect: non-scaling-stroke;
}
</style>
</head>
<body id="map">
<script type="text/javascript" type="text/javascript">
var po = org.polymaps;
var color = pv.Scale.linear()
.domain(0, 50, 70, 100)
.range("#F00", "#930", "#FC0", "#3B0");
var map = po.map()
.container(document.getElementById("map").appendChild(po.svg("svg")))
.center({lon: -133.62, lat: 24.23})
.zoom(4)
.zoomRange([2, 8])
.add(po.interact());
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.geoJson()
.url("/d/603043/test.json")
.zoom(4)
.tile(false)
.on("load", load)
.id("contours"));
map.add(po.compass()
.pan("none"));
function load(e) {
for (var i = 0; i < e.features.length; i++) {
var feature = e.features[i];
if (!feature.element) continue;
// feature.element.setAttribute("stroke", color(d).color);
feature.element.appendChild(po.svg("title").appendChild(
document.createTextNode(feature.data.id))
.parentNode);
}
}
</script>
<span id="copy">
&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>
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment