Skip to content

Instantly share code, notes, and snippets.

@bmount
Created December 11, 2011 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmount/1462337 to your computer and use it in GitHub Desktop.
Save bmount/1462337 to your computer and use it in GitHub Desktop.
// Add G, [minx, miny, maxx, maxy] as a bbox option to polymaps, after line 212:
case "G": {
var nw = po.map.coordinateLocation({row: c.row, column: column, zoom: c.zoom}),
se = po.map.coordinateLocation({row: c.row + 1, column: column + 1, zoom: c.zoom}),
pn = Math.ceil(Math.log(c.zoom) / Math.LN2);
return nw.lon.toFixed(pn)
+ "," + se.lat.toFixed(pn)
+ "," + se.lon.toFixed(pn)
+ "," + nw.lat.toFixed(pn);
}
// Then add your geojson
map.add(po.geoJson()
.url("http://localhost:5984/sf_bike_ped_acc/_design/gc-utils/_spatial/_list/geojson/geoms?bbox={G}")
// Should be able to write one function with a number, per zoom level, like geojson_{num} and do a full tms style map in polymaps:
map.add(po.geoJson()
.url("http://localhost:5984/sf_bike_ped_acc/_design/gc-utils/_spatial/_list/geojson_{Z}/geoms?bbox={G}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment