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

# How to determine if a node is inside a relation (multipolygon)?

 1 For example: Is this place place_id="68487739" osm_type="way" osm_id="21854741" place_rank="26" boundingbox="51.7358468,51.7373514,8.7433035,8.7458768" lat="51.7361866" lon="8.7446936" display_name="Meisenweg, Paderborn, Kreis Paderborn, Regierungsbezirk Detmold, Nordrhein-Westfalen, 33102, Deutschland" class="highway" type="residential" importance="0.32" inside this relation Edit: Precise description of the problem: How can I determine if a GPS-coordinate (latitude & longtitude) from any node is inside any self-contained relation/area/multipolygon? The area can be an existing boundary like "Regierungsbezirk Detmold" but it can also be a random multipolygon. asked 03 Jan '17, 17:48 AkeStrop 26●1●1●2 accept rate: 0% are you looking for a solution for this case only or something automated? (03 Jan '17, 22:38) aseerel4c26 ♦ No, nothing automated. Just a solution for this case would be enough ;) (04 Jan '17, 08:30) AkeStrop

 0 [Answer edited, as the question has changed significantly] If you need to solve the general is a point "in" an OSM "area" for a larger number of points and areas I suspect the simplest way to do this is to import an OSM extract for the area in question in to a Postgis DB with osm2pgsql and then do spatial queries on the data. Or ... there are many alternatives, but they all (even if you simply roll your own code after reading a corresponding text) will likely require you to first actually create the geometry of the OSM "area" object in question, which in general is not something for the faint hearted so you should simply use something that is known to work. More details on your application and what you are really trying to do would help with a more specific answer. answered 04 Jan '17, 08:46 SimonPoole ♦ 44.7k●13●326●701 accept rate: 18% That's absolutely right and a really simple solution, but that's unfortunately not the solution for my problem. Let me be more precise and rephrase my problem: How can I determine if a GPS-coordinate (latitude & longtitude) from any node is inside any self-contained relation/area/multipolygon? The area can be an existing boundary like "Regierungsbezirk Detmold" but it can also be a random multipolygon. So your suggested solution don't solve the problem if it's a random multipolygon. I hope this describes the problem better. (04 Jan '17, 14:13) AkeStrop

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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:

×132
×128
×92

question asked: 03 Jan '17, 17:48

question was seen: 2,923 times

last updated: 05 Jan '17, 21:27

### Related questions

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