NOTICE: is being shutdown on 1st March 2024. Please use the OpenStreetMap Community Forum

I have a lot of GPS coordinates. How can I find the respective element id according the GPS data? (I can not use the webpage and per the mouse click on the query button, since I have too many points...)

For example:

Given this GPS coordinate: [51.645401, 12.052744]

Return the element id: farmland #6249468

How can I do that?

asked 09 Feb '17, 16:12

xirururu's gravatar image

accept rate: 0%

edited 09 Feb '17, 18:12

The query button on the website is implemented using a publicly available service, Overpass-API:

There is some discussion of it in the website code:

(the query language used there is documented at )

You can experiment with Overpass-API using a convenient gui at Overpass Turbo:

I've only added a piece of the query there, the is_in operator returns a subset of nearby objects, you'd need to add the around operators and experiment a bit to see if the output is useful for what you need.

permanent link

answered 09 Feb '17, 23:52

maxerickson's gravatar image

accept rate: 32%

@maxerickson Thanks so much for the answer! Run your is_in() function works perfectly. But how can I write the nearby function? According your query.js file, I made the nearby function. But it doesn't work.

(node(around:100, 51.645401, 12.052744); way(around:100, 51.645401, 12.052744));

out tags;

relation(around:10, 51.645401, 12.052744); out;

Here is my code in overpass-turbo

(10 Feb '17, 01:34) xirururu

There are no features within the 100 meter radius. Increasing it returns some features (200 works for nodes).

Also get rid of the tags from the output statement. That removes the geographic information from the results. out geom will add geographic information for ways and relations.

(10 Feb '17, 03:12) maxerickson

@maxerickson Thanks! I still have a little doubt, The gps point [51.645401, 12.052744] is actually in the "Farmland #6249468", but why it returned as a nearby feature?

(10 Feb '17, 10:56) xirururu

The areas that the is_in operator returns are generated by Overpass API using a set of rules. For landuse types (and most other features), they are only included as areas if they have a name.

The rules are here:

(10 Feb '17, 13:32) maxerickson
Your answer
toggle preview

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 Feb '17, 16:12

question was seen: 2,596 times

last updated: 10 Feb '17, 13:32

NOTICE: is being shutdown on 1st March 2024. Please use the OpenStreetMap Community Forum