Skip to content

Instantly share code, notes, and snippets.

@vallettea
Created February 23, 2014 13:04
Show Gist options
  • Save vallettea/9171122 to your computer and use it in GitHub Desktop.
Save vallettea/9171122 to your computer and use it in GitHub Desktop.
# connect to the db
psql -d idf -U postgres
# get first few nodes having tags
select * from nodes where array_length(akeys(tags),1) >0 limit 5;
# get nodes having tag key "highway"
select * from nodes where tags ? 'highway' limit 10;
# select amenity fuel
select * from nodes where tags @> 'amenity=>fuel' limit 10;
# render as you like
select st_x(geom),st_y(geom), tags from nodes where tags @> 'amenity=>fuel' limit 10;
# dump all of them to a csv
\copy (select st_x(geom),st_y(geom), tags from nodes where tags @> 'amenity=>fuel') To 'fuels.csv' With Delimiter ';'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment