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

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's gravatar image

Paulosm2016
25335
accept rate: 0%

edited 19 Sep '16, 21:54

1

Whenever I need boundaries, I use https://wambachers-osm.website/boundaries/

(20 Sep '16, 04:17) escada

After searching a bit more, this could ofcourse also be a data-error...

(20 Sep '16, 07:37) Paulosm2016
1

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.)

(21 Sep '16, 14:03) joost schouppe

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?

(22 Sep '16, 08:59) Paulosm2016

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

(22 Sep '16, 15:21) 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

permanent link

answered 27 Sep '16, 08:24

Paulosm2016's gravatar image

Paulosm2016
25335
accept rate: 0%

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:

×129
×37

question asked: 19 Sep '16, 21:53

question was seen: 2,723 times

last updated: 05 Jul '17, 08:11

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