Skip to content

Instantly share code, notes, and snippets.

@mvexel
Created October 18, 2017 16:11
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 mvexel/4aee67b81f5ddba1c185e2ec103bb9b6 to your computer and use it in GitHub Desktop.
Save mvexel/4aee67b81f5ddba1c185e2ec103bb9b6 to your computer and use it in GitHub Desktop.
query on a TIGER states table (Imported from Census SHAPE using shp2pgsql) to generate GeoJSON for each that osmium will understand.
COPY (
SELECT name, jsonb_build_object(
'type', 'Feature',
'id', gid,
'geometry', ST_AsGeoJSON(geom)::jsonb,
'properties', to_jsonb(row) - 'gid' - 'geom')
FROM (SELECT * FROM cb_2016_us_state_500k) row)
TO '/Users/martijnv/osm/planet/states.tsv';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment