Created
January 12, 2011 22:53
-
-
Save mager/777066 to your computer and use it in GitHub Desktop.
How to display SimpleGeo Places on a map
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> | |
<style type="text/css"> | |
@import url("http://github.com/simplegeo/polymaps/raw/v2.4.0/examples/example.css"); | |
html, body {height: 100%;} | |
svg {display: block;} | |
.layer circle {fill: #ACC3CC;stroke: #000;stroke-width: 2px;} | |
</style> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> | |
<script type="text/javascript" src="http://cdn.simplegeo.com/js/1.2/simplegeo.places.jq.min.js"></script> | |
<script type="text/javascript" src="http://github.com/simplegeo/polymaps/raw/v2.4.0/polymaps.js"></script> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
var client = new simplegeo.PlacesClient('E3mbEYGWRppsZtxAXbd3cm6PGaLUHTSz'); | |
var address = "41 Decatur St, San Francisco, CA"; | |
var po = org.polymaps; | |
var map = po.map() | |
.container(document.body.appendChild(po.svg("svg"))) | |
.center({lat: 37.772326, lon: -122.405784}) | |
.zoom(17) | |
.zoomRange([12, 18]) | |
.add(po.interact()); | |
map.add(po.image() | |
.url(po.url("http://{S}tile.cloudmade.com" | |
+ "/5814d279db61404b9e52115b06b9e7b3" // http://cloudmade.com/register | |
+ "/1714/256/{Z}/{X}/{Y}.png") | |
.hosts(["a.", "b.", "c.", ""]))); | |
var geoJson = po.geoJson(); | |
map.add(geoJson); | |
map.add(po.compass() | |
.pan("none")); | |
client.searchFromAddress(address, function(err, data) { | |
if (err) { | |
console.error(err); | |
} else { | |
geoJson.features(data.features); | |
} | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment