Answers to: How to get list of areas, in an area?https://help.openstreetmap.org/questions/47726/how-to-get-list-of-areas-in-an-area<p>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?</p>
<p>Shorter version of my ques: i need the list of areas(boundaries) inside a country(boundary)?</p>enFri, 26 Feb 2016 21:18:37 +0000Answer by maxericksonhttps://help.openstreetmap.org/questions/47726/how-to-get-list-of-areas-in-an-area/48373<p>Search for administrative boundaries using the known area as a filter:</p>
<p><a href="http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#By_area_.28area.29">http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#By_area_.28area.29</a></p>
<p>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.</p>maxericksonFri, 26 Feb 2016 21:18:37 +0000https://help.openstreetmap.org/questions/47726/how-to-get-list-of-areas-in-an-area/48373Answer by sanserhttps://help.openstreetmap.org/questions/47726/how-to-get-list-of-areas-in-an-area/48372<p>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. <br>
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. <br>
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: <br>
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. <br>
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: <br>
1. The outer border polygon Pb of area Ab is inside the outer border polygon Pa of area Aa; and <br>
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.<br>
Good luck and enjoy the OSM. </p>sanserFri, 26 Feb 2016 20:44:35 +0000https://help.openstreetmap.org/questions/47726/how-to-get-list-of-areas-in-an-area/48372