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

Hello

I am looking for way how can i check with coordinates type of place for example

50.064317, 19.948575

is it building, street or some field?

I am using leaflet too

Best regards

asked 22 Oct '18, 15:19

adacho26's gravatar image

adacho26
11112
accept rate: 0%


I use overpass with leaflet and i have something like this

first checking nodes of clicked point queryOverpass([out:json]; way["building"~"."](around:10, 50.065342, 19.952249)->.interesting_ways; node(w.interesting_ways)->.allnodes; .allnodes out;).then(console.log).catch(console.error);

and then beacuse i use radius (so this is approximately ) i am using leaflet function

Polygon.getBounds().contains(MarketLatLng);

Maybe it will help somebody

permanent link

answered 25 Oct '18, 11:02

adacho26's gravatar image

adacho26
11112
accept rate: 0%

The technical term for what you are trying to do is "reverse geocoding". Likely the easiest way to that with OSM is to use nominatim https://nominatim.openstreetmap.org/search.php?q=50.064317%2C+19.948575&polygon_geojson=1&viewbox=

If you are thinking of using this in a bulk mode please adhere to the aup https://operations.osmfoundation.org/policies/nominatim/ , our data licence https://wiki.osmfoundation.org/wiki/Licence/Licence_and_Legal_FAQ#What_is_the_licence.2C_how_can_I_use_it.3F and our general terms of use https://wiki.osmfoundation.org/wiki/Terms_of_Use

permanent link

answered 23 Oct '18, 12:08

SimonPoole's gravatar image

SimonPoole ♦
44.7k13326701
accept rate: 18%

I have too much operations, so this way is not good :( Is there another option to load all building in some layer and then check without connection ?

(23 Oct '18, 12:17) adacho26

Reverse geocoding only works well for addresses and POIs. It doesn't really work for "fields", buildings without addresses and other objects which don't really fit into the POI category. Overpass API might be the better choice.

(23 Oct '18, 12:20) scai ♦

@scai I cannot find any toturial how to use Overpass API with react or/and leaflet.. can u tell me briefly how to get info about type of pattern (grass/building) with overpass?

(23 Oct '18, 15:10) adacho26

Looks like there are multiple Leaflet plugins available for Overpass API. I've never used both together so I can't recommend a specific one. But you should find multiple examples when using your favorite search engine.

(24 Oct '18, 08:15) scai ♦

@scai, I wonder whether the around function is the solution for the OP's problem. One has to specify a "distance" around the current point to find polygons in the neighbourhood of the give point. The will also give nearby objects, not just enclosing objects. Or do you have something else in mind ?

(24 Oct '18, 11:14) escada

@escada That's what I have in mind. Similar to the query feature at openstreetmap.org. It works a little bit different than reverse geocoding, that's true.

(24 Oct '18, 11:44) scai ♦
showing 5 of 6 show 1 more comments

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:

×144
×74

question asked: 22 Oct '18, 15:19

question was seen: 3,880 times

last updated: 25 Oct '18, 11:02

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