Skip to content

Instantly share code, notes, and snippets.

@vallettea
Created December 11, 2013 11:14
Show Gist options
  • Select an option

  • Save vallettea/7908648 to your computer and use it in GitHub Desktop.

Select an option

Save vallettea/7908648 to your computer and use it in GitHub Desktop.
postgis commands
select w.id, st_x(n.geom), st_y(n.geom), w.tags from ways as w INNER join nodes as n on n.id = w.nodes[1] where w.tags->'leisure'='swimming_pool';
\copy (select w.id, st_x(n.geom), st_y(n.geom), w.tags from ways as w INNER join nodes as n on n.id = w.nodes[1] where w.tags->'leisure'='swimming_pool') To 'pools.csv' With Delimiter ';' CSV;
\copy (select id, tags, st_astext(linestring), nodes from ways as w where w.tags->'railway'='rail') To 'rails.csv' With Delimiter ';' CSV;
\copy (select n.uid, st_x(n.coordinates), st_y(n.coordinates), date_part('hour',date_time), extract(DOW from date_time), n.nb_vehicles,n.severity,n.nb_casualties from accidents as n) To 'accidents.csv' With Delimiter ';' CSV;
\copy (select osmid, st_astext(geom) from highways) To '../../../data/highwaysLondon.csv' With Delimiter ';'
\copy (select uid, st_Asgeojson(geom) from sections) To 'parisSections.csv' With Delimiter ';'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment