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

Hello!

I am querying an Overpass API in order to get the closest cities to another one with the following request: [out:json];node['place'='city']['name'='Malaga']->.center; node(around.center:100000)['place'='city']; out;

However, the above does not return anything unless I change Malaga with Málaga. Is this expected? I thought multilingual city names would be supported.

Thank you in advance and regards.

asked 07 Aug '20, 20:46

dejavits's gravatar image

dejavits
31224
accept rate: 0%


I think Overpass uses exactly what you asks him. So if you want to use an international name you should either use name:xx=Malaga (with XX being the code of the language, i.e. en, fr, de, it, etc.) or use a regex and write something like ~"name:[a-z][a-z]"~"Malaga"

permanent link

answered 08 Aug '20, 00:37

Mannivu's gravatar image

Mannivu
1.1k31027
accept rate: 6%

Thanks! I have checked and name:en does not exist for this city, however, it works with name:de. I think the most convenient for me would be to use [a-z][a-z] but it does not work either: [out:json];node['place'='city']['name:[a-z][a-z]'='Malaga']->blablabla

Any idea why?

(08 Aug '20, 09:56) dejavits

You forgot the ~ before and after "name:[a-z][a-z]"

(08 Aug '20, 10:01) Mannivu

In this example i used this query [out:json];node['place'='city'][~"name:[a-z][a-z]"~"Malaga"]->.center; node(around.center:100000)['place'='city']; out; and it worked.

(08 Aug '20, 12:31) Mannivu
1

Thanks! It worked :)

(09 Aug '20, 07:45) dejavits

Generally speaking the name tag should carry the name in the local language, diacritics and all. Where this language isn't English there may be an additional name:en tag for the English name (and so on for other languages). The main exception to this rule is in a few places where there are several local languages and the local community have decided on a convention or a "neutral" language instead.

If you want to use overpass for this query you will probably need to look at the name and name:__ tags.

Alternately you may want to do the initial geocoding with something like Nominatim and pass its response to Overpass for the second part of your query.

permanent link

answered 08 Aug '20, 00:40

InsertUser's gravatar image

InsertUser
11.0k1369185
accept rate: 19%

Thanks! I have tried with name: en but still does not work. I believe this city does not have "en" tag because if I use name:de (German) it works!. Is there a way to search for the city name matching any of the available languages available for the city?

(08 Aug '20, 09:55) dejavits

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:

×483
×85

question asked: 07 Aug '20, 20:46

question was seen: 2,448 times

last updated: 09 Aug '20, 07:45

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