Guest User

Untitled

a guest
Feb 7th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. select st_asgeojson(the_geom) from street_centerline limit 1;
  2.  
  3. {"type":"MultiLineString","coordinates":[[[-65.591776562805038,41.682190576167052],[-65.591998971284028,41.682082119060382],[-65.592001213509064,41.682081025737766],[-65.593689871787177,41.681257533373952],[-65.595415661879244,41.680415888937219],[-65.595440519465640,41.680403765889309],[-65.595603134242481,41.680324459445771]]]}
  4.  
  5. ogr2ogr -f GeoJSON out.json
  6. "PG:host=localhost dbname=gis user=ubuntu password=toomanysecrets"
  7. -sql "select way,name,amenity from planet_osm_point a where a.amenity is not null"
  8.  
  9. GRANT SELECT ON geometry_columns to ubuntu;
  10. GRANT SELECT ON geography_columns to ubuntu;
  11. GRANT SELECT ON spatial_ref_sys to ubuntu;
  12.  
  13. SELECT jsonb_build_object(
  14. 'type', 'FeatureCollection',
  15. 'features', jsonb_agg(feature)
  16. )
  17. FROM (
  18. SELECT jsonb_build_object(
  19. 'type', 'Feature',
  20. 'id', gid,
  21. 'geometry', ST_AsGeoJSON(geom)::jsonb,
  22. 'properties', to_jsonb(row) - 'gid' - 'geom'
  23. ) AS feature
  24. FROM (SELECT * FROM input_table) row) features;
Add Comment
Please, Sign In to add comment