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

I want to find the old name of the city. So, using Nominatim API I just execute

And have a list of city's names.

But I can't figure out how to execute this query from the database.

I can write something like: SELECT name FROM placex WHERE OSM_ID='XXXXX'

But to do it I need to know the OSM_id of the city.

So, my question is How to find old names (or at least osm_id) of the city if I have city_name, state and country?

asked 18 Aug '20, 14:30

MariiaZav's gravatar image

accept rate: 0%

Searching for city use the API documented in

saint petersburg, russia

or structured, though many big cities are also states which makes it harder for a computer to differentiate

If you have your own server replace the domain the IP address of your server or 'localhost'.

Alternatively in your installation in the 'build' directory there's a script utils/query.php.

Add &namedetails=1 and you get a list of all names.

"name:tzl": "Sant Pairbuerg", "short_name": "СПб", "alt_name:mk": "Петроград", "alt_name:pl": "Sankt Petersburg", "alt_name:vi": "Sankt-Peterburg", "old_name:ar": "لينينغراد;بيتروغراد", "old_name:ca": "Petrograd;Leningrad",

permanent link

answered 18 Aug '20, 23:07

mtmail's gravatar image

accept rate: 27%

Thank you for your answer. I have no problem to execute query from Nominatim API. The main problem is to run this query from the database. It has 784 tables and no descriptions of it.

I can't figure out how to get osm_id of the city without using Nominatim API and just using database.

(19 Aug '20, 19:01) MariiaZav

Adding &debug=1 to the URL gives some output of the SQL that is run. In the background Nominatim uses several thousand lines of code to create and manage the SQL, finding places in a world-wide database is complex, especially finding the most relevant/important city when many have the same name. There's no single or few SQL queries one can run manually to get the same result.

(19 Aug '20, 20:49) mtmail

Thank you so much! I didn't know about the debug mode. It helps me a lot!

(20 Aug '20, 08:23) MariiaZav

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 18 Aug '20, 14:30

question was seen: 3,603 times

last updated: 20 Aug '20, 08:23

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