Skip to content

Instantly share code, notes, and snippets.

@kapadia
Created October 28, 2014 00:07
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 kapadia/a4f0b1d7e5300a309f39 to your computer and use it in GitHub Desktop.
Save kapadia/a4f0b1d7e5300a309f39 to your computer and use it in GitHub Desktop.
geojson.sql
psql -Atc "SELECT row_to_json(fc) FROM ( SELECT 'FeatureCollection' As type, array_to_json(array_agg(f)) As features FROM (SELECT 'Feature' As type, ST_AsGeoJSON(box2d(ST_Buffer(ST_Transform(lg.wkb_geometry, 3857), 300)))::json As geometry, row_to_json((scene_id, created)) As properties FROM scenes As lg WHERE scene_id='$sceneid') As f ) As fc;" > $bounds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment