Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ogr2ogr -f GeoJSON out.json "PG:host=localhost dbname=xxx user=xxx password=xxx"
- -sql 'select id, county, wkb_geometry from cities where id=47927526'
- SELECT row_to_json(featcoll)
- FROM
- (SELECT 'FeatureCollection' As type, array_to_json(array_agg(feat)) As features
- FROM (SELECT 'Feature' As type,
- ST_AsGeoJSON(tbl.geom)::json As geometry,
- row_to_json((SELECT l FROM (SELECT id, prop1, prop2, ...) As l)
- ) As properties
- FROM your_table As tbL
- WHERE st_intersects(geom, st_setsrid(st_makebox2d(st_makepoint(x1, y1),st_makepoint(x2, y2)), srid))
- ) As feat
- ) As featcoll;
- $ogr2ogr -f GeoJSON out.json "PG:host=localhost dbname=xxx user=xxx password=xxx"
- -sql 'select id, county, wkb_geometry from cities where id=47927526'
- $ogr2ogr -f GeoJSON out.json "PG:host=localhost dbname=xxx user=xxx password=xxx"
- -sql 'select id, county, wkb_geometry from cities where id IN (47927526, 47927527, 47927528, 47927529, ...)'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement