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


I am using Overpass API to count the number of POIs for different categories and for different cities. However, the the city names I use, sometimes don't match the ones tagged in OSM.

Example: I use "Southbridge Town" but in OSM is listed as "Southbridge" (sometimes using "Southbridge Town" returns some POIs)

Example request:

area[place~"city|village|town|locality"]["name"="Southbridge Town"]->.city;
area["addr:city"="Southbridge Town"]->.address;
out count;

I am looking for a general method for matching my city names with the ones used in OSM using regular expressions or Overpass tools. I use Python to build the query and make the request.

Thank you!

This question is marked "community wiki".

asked 09 Mar '22, 10:24

ocabanas's gravatar image

accept rate: 0%

edited 09 Mar '22, 18:20

First to answer your question the solution is ot use the 'something like' operative which you've already used - [name~"Southbridge"]

However it's not required as there's only one Southbridge place.

addr:city is a tag of an object & can not be used to construct areas.

This routine returns the same results as your routine

out geom;
permanent link

answered 09 Mar '22, 18:03

DaveF's gravatar image

accept rate: 16%

There was an error in my initial question. I use ["name"="Southbridge Town"] and it should be recognized as "Southbridge". Also, using "addr:city" works well in my tests.

(09 Mar '22, 18:23) ocabanas

Show the areas produced by the addr:city line.

The are no 2Southbridge Town" objects.

(09 Mar '22, 19:14) DaveF

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: 09 Mar '22, 10:24

question was seen: 1,307 times

last updated: 09 Mar '22, 19:41

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