This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Extract all cities with lat lon coords from Slovakia

0

I need to extract all cities with lat lon coords from Slovakia OSM.

This is how I imported OSM file downloaded from Geofabrik:

osm2pgsql --slim --username postgres --database gis --hstore slovakia-latest.osm
psql -U postgres -d gis
CREATE EXTENSION hstore;

Import went without errors.

What SELECT query should be to see 3 tables (city, latitude, longitude)?

asked 03 Jun '21, 18:10

akulin's gravatar image

akulin
21336
accept rate: 0%


One Answer:

0
SELECT name, st_astext(st_transform(way, 4326)) FROM planet_osm_point WHERE place='city' OR place='town' ORDER BY name;

answered 21 Sep '21, 16:04

akulin's gravatar image

akulin
21336
accept rate: 0%

edited 22 Sep '21, 11:35

Source code available on GitHub .