NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I need to extract all cities with lat lon coords from Czech Republic OSM with English names of suburb and cities.

This is how I imported OSM file downloaded from Geofabrik:

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

Import went without errors.

Then I used this 2 queries to extract lat lon coords and names of suburb and cities:

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

Example:

st_astext,name
POINT(12.3669594982785 50.1246967948147),Aleje-Zátiší
POINT(12.7287439982281 50.4273214948056),Altstadt
POINT(15.5997642978285 49.467412494836),Antonínův Důl

It's all done well, but I got only names on Czech language. How to get the same list but with English names of suburb and cities?

asked 21 Sep '21, 16:13

akulin's gravatar image

akulin
21336
accept rate: 0%

edited 22 Sep '21, 12:39


You have not imported the English names into your database.

You will need to either modify the "style file" that comes with osm2pgsql to load the name:en tag into the database, or use the --hstore flag on import which will create an additional column called "tags" that contains the additional data.

Then you can select "name:en" respectively tags->'name:en' instead of name and work with that.

permanent link

answered 21 Sep '21, 16:37

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

1

Akuli, please also keep in mind that not all places you are looking for will have a name:en tag (actually, I believe only few will have). Depending on your use case you may need to have fallback to the name tag. Another way would be to check if there is a wikidata tag and look up an English name on Wikidata (outside your existing workflow).

(22 Sep '21, 08:20) TZorn
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×263
×134
×34

question asked: 21 Sep '21, 16:13

question was seen: 999 times

last updated: 22 Sep '21, 12:39

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum