Created
April 14, 2011 16:55
-
-
Save mager/919917 to your computer and use it in GitHub Desktop.
Polymaps example for shading polygons
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> | |
<title>San Francisco Street Pavement</title> | |
<script type="text/javascript" src="https://github.com/simplegeo/polymaps/raw/master/lib/protovis/protodata.js"></script> | |
<script type="text/javascript" src="https://github.com/simplegeo/polymaps/raw/master/polymaps.js"></script> | |
<style type="text/css"> | |
@import url("https://github.com/simplegeo/polymaps/raw/master/examples/example.css"); | |
body { | |
background: #021019; | |
} | |
.compass .back { | |
fill: #256574; | |
} | |
.compass .fore, .compass .chevron { | |
stroke: #1AA398; | |
} | |
#streets path { | |
fill: #567851; | |
opacity: 0.6; | |
stroke-linecap: round; | |
} | |
#copy, #copy a { | |
color: #1AA398; | |
} | |
</style> | |
</head> | |
<body id="map"> | |
<script type="text/javascript" src="parks.js"></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> |
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
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({lat: 37.76, lon: -122.44}) | |
.zoom(13) | |
.zoomRange([12, 16]) | |
.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("parks.json") | |
.id("streets") | |
.zoom(12) | |
.tile(false) | |
.on("load", po.stylist() | |
.attr("stroke", function(d) { return color(d.properties.PCI).color; }) | |
.title(function(d) { return d.properties.STREET + ": " + d.properties.PCI + " PCI"; }))); | |
map.add(po.compass() | |
.pan("none")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment