Hi, I'm looking for a way to get lines of an administrative level (f.e. 4) with no duplicate parts. When I select all lines from planet_osm_line where admin_level=4 (within a specific country, in this case Papua new guinea) then I get the following: 5 records with osm_id=-311772, that I don't want because they duplicate the geometry of the adjacent level-4 polygon 1 record with osm_id=284884115, which is good no record with osm_id=352439111, which is not good, it's part of the boundary of that polygon. Some links: full polygon: http://www.openstreetmap.org/relation/311772#map=12/-6.1016/144.1605 part in the result-set: http://www.openstreetmap.org/way/284884115#map=12/-6.1015/144.1605 missing part: http://www.openstreetmap.org/way/352439111#map=12/-6.1015/144.1605 The missing part is a river which also is the boundary of that polygon. Is this something that has to be fixed in the osm2pgsql config (style-file)? relevant part: node,way admin_level text linear or is there some query where I can include the missing parts easily? asked 19 Sep '16, 21:53 Paulosm2016 |
I finally figured it out. I join the planet_osm_line l table with the planet_osm_rels r on r.parts@>array_append(NULL,l.osm_id) and hstore(tags)->'boundary' ='administrative' From there I can make my selection without duplicate lines answered 27 Sep '16, 08:24 Paulosm2016 |
Whenever I need boundaries, I use https://wambachers-osm.website/boundaries/
After searching a bit more, this could ofcourse also be a data-error...
I really don't understand the question. What exactly is going wrong?
You get 5 records of relation (polygon) 311772, but that's no problem? You seem to call way 284884115 a polygon, but that's just a line. Or is the problem that way 352439111 is missing from the polygon 311772?
(Boundaries are relations which are built upon ways. So it is perfectly normal that a way is called by several relations.)
The more I think about it, the more convinced I am that it's a data issue, but I don't know enough of the rules to be sure.
Should there be a way with the same geometry as way 352439111, and that way having admin_level and boundary tags?
After more investigation I'm getting to the conclusion that I don't understand how to render administrative boundaries where f.e. a river is used to define part of the boundary (there doesn't seem to be an admin_level tag in that case), so if anyone can answer me that, I think it would answer my main question