Skip to content

Instantly share code, notes, and snippets.

@yhahn
Created October 6, 2012 21:01
Show Gist options
  • Save yhahn/3846110 to your computer and use it in GitHub Desktop.
Save yhahn/3846110 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Example</title>
<script type='text/javascript'>
var geojson = [];
function jsonpdata(data) {
for (var i = 0; i < data.results.length; i++) {
geojson.push({
geometry: {
type: 'Point',
coordinates: data.results[i].loc
},
properties: {
title: data.results[i].race,
description: data.results[i].sex
}
});
}
};
</script>
<script src='http://api.occupy-data.org/stopandfrisk/v1/loc/$near=-73.88:40.78:1.3/?results&value=loc&value=race&value=sex&callback=jsonpdata'></script>
<script src='http://api.tiles.mapbox.com/mapbox.js/v0.6.6/mapbox.js'></script>
<link href='http://api.tiles.mapbox.com/mapbox.js/v0.6.6/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id='map'></div>
<script>
mapbox.auto('map', 'examples.map-vyofok3q', function(m) {
var markerLayer = mapbox.markers.layer().features(geojson);
m.addLayer(markerLayer);
m.centerzoom({lon:-73.9109, lat:40.7858}, 12);
mapbox.markers.interaction(markerLayer);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment