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

Handling of invalid locations in area assembler #195

Closed
joto opened this issue Feb 9, 2017 · 4 comments
Closed

Handling of invalid locations in area assembler #195

joto opened this issue Feb 9, 2017 · 4 comments

Comments

@joto
Copy link
Member

joto commented Feb 9, 2017

Currently the area assembler expects all locations in the ways it uses to create a (multi)polygon to be valid. If a location is not valid, the result is not well defined. In most cases it will probably just fail to create the multipolygon, but it could also create totally broken ones.

This is most certainly something we want to fix. The assembler should either throw an exception or just not try to build any area. Other failures in the data are handled by the assembler by not building any area (and possibly reporting the error throw a "problem_reporter"), so I tend towards using the same mechanism here also.

This came up in the context of osm2pgsql-dev/osm2pgsql#684 . osm2pgsql wants to be able to handle the case of invalid locations by just ignoring those locations and trying to build an area from the remaining valid locations. This could help at the boundary of an extract. I do not think this is the right solution, though, because it could lead to wrong polygons like in this example:

ignore-invalid-locations-area

Ignoring all locations outside the dotted box would create a triangular polygon exactly where the original polygon is not!

/cc @lonvia @pnorman

@pnorman
Copy link

pnorman commented Feb 9, 2017

osm2pgsql wants to be able to handle the case of invalid locations by just ignoring those locations and trying to build an area from the remaining valid locations. This could help at the boundary of an extract. I do not think this is the right solution, though, because it could lead to wrong polygons like in this example

Do we? I don't think that's current behavior.

@lonvia
Copy link
Member

lonvia commented Feb 9, 2017

@lonvia
Copy link
Member

lonvia commented Feb 9, 2017

We actually make use of the feature for rendering the Swiss map on http://osm.ch. The extract is created from a padded Swiss polygon with excat cutting (only nodes inside the polygon). The rendered map has the landcover roughly follow the extract polygon, so it's a cheap way to get a cut-out-effect. It's far from perfect, there are smaller rendering errors and sometimes missing areas where a multipolygon is now incomplete. So I would be in favour of keeping the current behaviour and just skipping over the missing nodes. For those who prefer to render the full polygons on extract boundaries, extracts with the complete way option or osmium smart extracts can be used.

joto added a commit that referenced this issue Feb 10, 2017
The area::Assembler now detects invalid locations in the ways used to
assemble an area. It will count them and report them in the stats and
through the problem reporter. If the new config option
ignore_invalid_locations is set, the Assembler will pretend they weren't
even referenced in the ways.

See #195.
@joto
Copy link
Member Author

joto commented Feb 10, 2017

I have added support for ignoring invalid locations in 3459e84.

@joto joto closed this as completed Feb 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants