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


Hi there! Very new to using OSM and have read the docs but still am not sure about the use.

I am trying to match latitude and longitude coordinates to a road (any kind under the "highway"). But each is taking 1 second and I have about 1 million coordinates to check. What is the best approach to speed things up? If my current approach is completely wrong, please advise on how I should do so!

Unsure on how to get the bbox for the countries I am looking at(only 2) and I've downloaded the .osm files but unsure how to use them.

Currently using the following(c1 and c2 are the coordinates):

api = overpass.API()
qur = 'way["highway"~"."](around:10,' + c1 + ', '+ c2 +');' 
data = api.get(qur, verbosity='geom')

Thank you!

asked 08 Feb '19, 02:32

hellu's gravatar image

accept rate: 0%

edited 08 Feb '19, 06:13

aseerel4c26's gravatar image

aseerel4c26 ♦

Running a million requests against the Overpass API will get you blocked. Don't do it. The project gives away its data for free, but we have to pay for servers like everyone else does, and checking your one million coordinates for you is not an appropriate use of our server resources.

Also, Nominatim (the geocoder) seems like a much better match for your problem than Overpass, though the same usage restrictions apply.

What you should be doing is setting up your own database, and then querying that. Most likely you'll want to set up a local Nominatim instance, though if you're not interested in administrative entities and really just want the name of the nearest road, a simplified osm2pgsql import and some SQL queries might also be an option. If you set up your own database locally, you'll save a lot of time in network round-trips alone, and you don't compete against other users of the system. If your coordinates are all in the same region or country, you don't even have to load a world-wide data set which will speed up things even further.

permanent link

answered 08 Feb '19, 06:52

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
accept rate: 23%

edited 08 Feb '19, 06:53


Hi! thanks for the heads up. just to confirm, I should be following this to set up my own Nominatim server? and the dataset would the the <countryname>-latest.osm.pbf file?

(08 Feb '19, 07:21) hellu

Yes that should work. As I said, depending on what exactly your problem is, other approaches might also work but a standard Nominatim install is certainly a good start.

(08 Feb '19, 08:17) Frederik Ramm ♦

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: 08 Feb '19, 02:32

question was seen: 2,586 times

last updated: 08 Feb '19, 08:17

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