Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Administrative boundary is not rendering consistently #3822

Closed
seav opened this issue Jul 18, 2019 · 10 comments
Closed

Administrative boundary is not rendering consistently #3822

seav opened this issue Jul 18, 2019 · 10 comments
Labels

Comments

@seav
Copy link

seav commented Jul 18, 2019

Expected behavior

All boundary ways should be rendered for all role=outer and inner way members of a type=boundary + boundary=administrative + admin_level=10 relation.

Actual behavior

One outer member way is not rendered with the usual dotted line, while adjacent member ways have their dotted lines rendered. Weirdly, the administrative boundary name label is rendered along the unrendered boundary way (see attached screenshot) which implies that there is no geometry problem in the boundary relation itself.

Links and screenshots illustrating the problem

The outer boundary member way that is not rendered with dotted lines (but labels are rendered): https://www.openstreetmap.org/way/704324668

Screenshot (missing boundary is near the bottom of the image):
Screenshot_2019-07-18 OpenStreetMap

@jeisenbe
Copy link
Collaborator

jeisenbe commented Aug 1, 2019

I've downloaded the data and tested it with the current master branch, with the same rendering result.

The high-zoom level administrative boundary lines are rendered based on type=boundary and multipolgyon relations imported into planet_osm_roads and tagged with boundary=administrative' plus admin_level=<1 to 10>. There appears to be a properly constructed type=boundary` relation with this tags which includes the missing way as a member with role "outer". So I'm not sure what is happening here. The way is also tagged individually with boundary=administrative and admin_level=10, but this isn't used for rendering the lines, as far as I can tell. Deleting this tags did not change the (lack of) rendering of this way.

The name label may still rendering because the administrative boundary labels are rendered from both relations and ways, but I'm not sure.

Does anyone understand the cause of this behavior?

The relation is Mampio (9794046) and the way is 704324668

@pnorman
Copy link
Collaborator

pnorman commented Aug 1, 2019

The next step is to load that data and then examine it in the DB with qgis or similar

@jeisenbe
Copy link
Collaborator

jeisenbe commented Sep 5, 2019

Walter left a comment which I received in email, though it seems to have disappeared here on github:

"This is quite simple: Because this way a) is not a member of an admin relation and b) is not closed (it has to be closed to be a polygon), it is not rendered.
"Fortunately, because we still have a lot of this junk in the DB.
"Regards walter"

The rendering is now fixed, so it appears that the relation was broken previously. I'm not sure why I missed the problem in JOSM.

It's a bit of a mystery to me why the text label was still rendering above, when the line wasn't.

The only difference current difference between admin-high-zoom and admin-text layers are that admin-high-zoom is from planet_osm_roads and admin-text is from planet_osm_polygon. Both selection the same features with osm_id < 0 (only relations) now - but before 96c64fa admin-text was rendered from the ways, not just the boundary relations, so that's the source of the difference

@seav
Copy link
Author

seav commented Sep 5, 2019

I think this issue should be reopened because the bug is not resolved and has become slightly crazier. As you can see from the screenshot below, previously no border line was rendered but now two borders lines are rendered (the upper border is incorrect based on the stored data in OSM), and a segment of the coastline that is part of the admin relation (between the 2 duplicated borders) is not rendering as a border.

Screenshot_2019-09-05 OpenStreetMap

@jeisenbe
Copy link
Collaborator

jeisenbe commented Sep 6, 2019

You are right. I tried downloading the new data and rendering again on my setup, and I get the same error:

z17 current test rendering
z17-mampio-current

z19 current test
z19-cagayancillo-road-current

I guessed that it might be caused by an error in the line-simplify algorithm, but tests with this removed did not fix the problem:

Test without line-simplify:

z19 after
z19-after-no-line-simplify

I downloaded the full relation in JOSM and there are no validator errors now.

@jeisenbe jeisenbe reopened this Sep 6, 2019
@jeisenbe
Copy link
Collaborator

jeisenbe commented Sep 6, 2019

I fixed the rendering by reversing the direction of way 704324668 so that it's the same as the direction of the coastline:

z19-after-no-line-simplify

I'm not certain why this makes a difference. Other areas such as multipolygons seem to be imported without problems when not all of the ways are aligned end-to-end.

Is it an error in osm2pgsql, @pnorman?

@seav
Copy link
Author

seav commented Sep 6, 2019

I think the way direction should not make any difference. I think this edge case reveals a bug somewhere in the toolchain.

@jeisenbe jeisenbe added bug and removed invalid labels Oct 10, 2019
@jeisenbe
Copy link
Collaborator

Weirdly, the administrative boundary name label is rendered along the unrendered boundary way (see attached screenshot) which implies that there is no geometry problem in the boundary relation itself.

That is probably due to #2234 - admin line are rendered from planet_osm_roads which contains linestrings (if I understand correctly), but the text labels are rendered from planet_osm_polygon.

It is possible that switching the admin lines to render from planet_osm_polygon will also resolve this issue.

But I am still curious if there is something in osm2pgsql that is causing this error.

@matkoniecz
Copy link
Contributor

Ghost ways may be caused by a osm2pgsql bug osm2pgsql-dev/osm2pgsql#1394

https://lists.openstreetmap.org/pipermail/dev/2021-February/031048.html

The error happens when there is a boundary relation containing exactly
two ways forming a closed ring and the ways are oriented against each
other. So they both have the same first and last nodes. The bug does
not appear when the last node of one of the ways is the first node of
the other. (Most likely the bug will also happen if there are four
ways of which two create one ring and two another etc.)

It is also possible to fix at least some of these cases by simply
turning around one of the member ways. You can do this without the
software having been updated. Just take care that turning around the
way doesn't create other problems.

Once new osm2pgsql is deployed on OSM servers this bug will also disappear as boundaries are edited in general.

@matkoniecz
Copy link
Contributor

matkoniecz commented Feb 3, 2021

As original issue is fixed and phantom line is caused by a known bug I will close it. Thanks to @joto for a fix in osm2pgsql-dev/osm2pgsql#1396 !

Note that OSM servers will be fixed once it gets deployed and relevant boundaries are edited.

See also https://wiki.openstreetmap.org/wiki/User:Mmd/Overpass_API_-_experimental_corner#osm2pgsql_relation_issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants