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

Hi, I have an overpass API that retrieves me all the ways and nodes of the admin level 2 boundary for a given country. My example is Spain.

area["ISO3166-1"=ES];(rel(pivot);nw(r);node(w););out;

I postprocess the data I get from this and end up with 21 closed polygons. One of the polygons is made up of just one way:

Way ID = "46430215"

Which I believe is the maritime border for the island of Ibiza. There were no tags on the <way> though that told me this. I had to work it out manually using a totally unprogrmatic approach.

My ultimate aim is for a user to pick a location by long lat and then find out where this is. For this though I need to get polygons and check if the point is in a polygon. If it is, I need to tell the user something useful about the polygon like what it is called.

So how can I get information like this is an island and it is called Ibiza from OSM? the user could equally well of course chosen a point in the middle of mainland Spain or the Meditterranean Sea and I would want to give them relevant answers for these as well.

Any guidance on the approach I can use is most welcome, Chessel

asked 29 Dec '23, 15:25

Chessel's gravatar image

Chessel
11236
accept rate: 0%


There probably wouldn't be tags on the way if it exists just to be part of a boundary relation. A more general overview of how boundaries are recorded is here on the wiki. Whether the way is part of a hole in the area or an outline would depend on the role it had within the relation, which is also stored in the relation.

Overpass has an is_in query that should return all areas that encompass the supplied point(s). This data can be further processed to give relevant name tags etc.

It sounds to me like you might want reverse geocoding for a point you query. There are some existing geocoders that might get you something close to what you want with less effort.

permanent link

answered 24 Jan, 23:46

InsertUser's gravatar image

InsertUser
11.0k1369185
accept rate: 18%

Thanks for your reply. I've been on a bit of a journey of discovery with OSM and my understanding of how to use it is improving. Thanks for your links. I now know what areas are and what reverse geotagging is having done that reading. Many thanks.

(25 Jan, 09:39) Chessel
Your answer
toggle preview

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:

×24

question asked: 29 Dec '23, 15:25

question was seen: 288 times

last updated: 27 Jan, 02:21

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