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

Hi, I'm pretty new to OSM. I'm working on web application in WebGL, and I have 2 major questions:

  1. I would like to know how to correctly query for city boundaries polygon. I've tried to use JSONP and http.get requests to get data form '' but i cant get it, because of CORS policy. This server seems to be JSONP disabled. Does any other kind of similar API exists?

  2. To get proper relations of my address i'm querying '' multiple times, every time constructing new url. Query for address to get city, city to get country, etc. This works but feels really tiresome. How do I query nominatim, knowing street address and getting all info that I need (city, country, continent) ?

Can you give me some hints?

asked 13 Dec '16, 09:53

Treant's gravatar image

accept rate: 0%

edited 14 Dec '16, 22:54

aseerel4c26's gravatar image

aseerel4c26 ♦

Can you give examples of the Nominatim queries/URLs you're currently using?

(13 Dec '16, 15:25) mtmail


I'm starting with osm_id and lonlat

Getting city name -> from osm_id and lonlat:

Getting relation -> from city name:Łódź&format=json

Getting polygon -> from relation

I only have osm_id and lonlat available and I must query for city, relation, country, continent and so on. Can I do it with one url?

(14 Dec '16, 13:58) Treant

The osm_id of your initial search seems to be a street

To look up the hierarchy starting from the street to the country try and you need to parse the links in the first line. Then for each type and id you have to do more lookups.

Doing a forward search for "Łódź" is too risky as you might get the wrong place back. Searching by ids (and type N,W,R) is better.

OSM data doesn't contain continents.

The reverse search can include polygons: (for the polygon parameters see)

State and country polygons can become large (several megabytes). In this case set &polygon_threshold to a value between 0 and 1 to simplify the polygon in the result. 0.1 is usually a good compromise.

The public Nominatim service has a usage policy ( Both polygon search, especially with large polygons and the hierarchy lookup are "expensive" (take more server resources than usual queries). If you crawl whole countries you will get blocked. If you send requests too fast you will get blocked. If your goal is to create a website for (paying?) customers and require high availability real-time results you should setup your own Nominatim server.

permanent link

answered 14 Dec '16, 17:23

mtmail's gravatar image

accept rate: 27%


Thanks for your help, this pretty much solves it.

(19 Dec '16, 08:30) Treant

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: 13 Dec '16, 09:53

question was seen: 10,048 times

last updated: 19 Dec '16, 08:30

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