# How to get list of areas, in an area?

 0 lets say i have an area boundary of a country. now how do i get all the boundaries available in this country? like available state,city, even deeper boundaries? Shorter version of my ques: i need the list of areas(boundaries) inside a country(boundary)? asked 29 Jan '16, 09:16 Arun Gowtham 0●11●11●14 accept rate: 0%

 0 There is a big difference between "areas inside areas" and "boundaries inside boundaries". The first issue is much more general and I will try to answer that one. Assume an open simple 2D area is a set of all points strictly inside an outer/enclosing border polygon and strictly outside and arbitrary number (including zero) of inner/excluding/hole border polygons. A closed area, besides its inner points, contains all border points as well. You can prove that any complex area, or a set of complex areas, has a perfect coverage of disjunctive simple areas. Therefore, hereafter we consider only simple closed areas. We can say/define that an area Ab is inside another area Aa if, and only if, any inner or border point of Ab is an inner or border point of Aa. Now the question is how to check this condition efficiently? Here are some hints and suggestions: Any math/GIS library should contain (almost guaranteed) a function point-polygon(…) that returns one of the values for a given point and polygon: the point is strictly inside, outside or it is exactly on the polygon. Also, the library should contain a function polygon-in-polygon(…) that returns yes or no for two given polygons Pb and Pa. If not, you can make it easily using the point-polygon(…) function. Namely, we can say/define that Pb is inside Pa if any point of Pb is not strictly outside Pa. In addition, you can prove that Pb is inside Pa if, and only if, any of the node points of Pb is not strictly outside Pa and none of the node points of Pa is strictly inside Pb. Now, using the polygon-in-polygon(…) function you can efficiently check whether and area Ab is inside another area Aa. Namely, you can prove that a given area Ab is inside a given area Aa if, and only if: 1. The outer border polygon Pb of area Ab is inside the outer border polygon Pa of area Aa; and 2. Any hole polygon Ha of area Aa is either inside or outside the outer polygon Pb of area Ab. If inside, then Ha must be inside of a hole polygon Hb of area Ab. Good luck and enjoy the OSM. answered 26 Feb '16, 20:44 sanser 695●37●39●55 accept rate: 5% 2 As the question was specifically about Overpass API, this seems a bit OT. (27 Feb '16, 08:41) mmd
 3 Search for administrative boundaries using the known area as a filter: http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#By_area_.28area.29 Take care of the note there, that area(area) is not implemented, so you will need to search for ways and relations, the ones you want are probably tagged with boundary=administrative. answered 26 Feb '16, 21:18 maxerickson 12.6k●10●79●176 accept rate: 31% 1 To convert a way or relation back to an area (if available), use the `map_to_area` statement. (27 Feb '16, 08:40) mmd
 toggle preview community wiki:

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:

×443
×57
×4

question asked: 29 Jan '16, 09:16

question was seen: 5,350 times

last updated: 27 Feb '16, 08:41