-
-
Notifications
You must be signed in to change notification settings - Fork 126
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
[BUG] canBeLine
returns true for a closed way
#1167
Comments
Planetiler uses the area tag to determine if a closed way can be a polygon or line. area=no means it can only be a line, area=yes means it can only be a polygon, and no area tag means it can either be a line or a polygon. It looks like you need to set area=yes on that way to indicate it shouldn't be interpreted as a line |
Thanks for the quick response!
I don't mind checking in my code both |
planetiler/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/OsmReader.java Line 509 in 4ecb02d
|
I probably read the following code wrong: planetiler/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/OsmReader.java Line 716 in 4ecb02d
If I'm reading this correctly, it means it gives precedence to a way without an area tag instead of relaying on the |
Here's my suggestion, what do you think - this gives precedence to the area tag and if it's not defined it checks the geometry, another solution would be to give precedence to the geometry first, after that to the area tag.
|
I came out with something similar:
If we make canBeLine return false when closed and area is missing, or when not closed and area=yes then you will be unable to construct a line feature from those shapes. The current values give more flexibility to be able to do that, but make it harder to find what is most likely a line... Maybe what we need is:
Then you could always force a line feature to be emitted, even if it is the perimeter of an actual polygon, or force a polygon to be emitted as long as its closed but the |
I'm good with keeping this idea - meaning when area is not defined, use the value of closed. Otherwise, this comment needs to change as well, doesn't it? |
If |
I found there are 2 other projects that use other tags in addition to area to indicate what the most likely intent of a close way without an area tag should be:
The current behavior is that the client will filter these based on tags first, then use line or polygon to make a new one, so they wouldn't currently be missing anything and adding handling for those other tags would further limit what profiles could turn into a line or polygon. |
The following project went a step further in terms of trying to take tags into consideration (somewhat like osm-polygon-features): I prefer the simplistic approach of taking into consideration just the geometry itself: I did take some tags into consideration for multi polygons though... Regardless, I ended up changing my code to only check Having said that, I still believe the comment and the code should match, I'm fine either way, let me know if there's anything I can do to help here. |
OK thanks for the research and discussion, sounds like the path forward here should be:
? |
Sounds like a plan! Thanks for looking into this! |
Describe the bug
canBeLine
returns true for a closed wayTo Reproduce
Run planetiler on israel and check the return value of
canBeLine
for the following way: https://www.openstreetmap.org/way/123464650 - which is a closed way.According to the docs it should return false, shouldn't it?
See here:
planetiler/planetiler-core/src/main/java/com/onthegomap/planetiler/reader/WithGeometryType.java
Line 30 in 4ecb02d
Expected behavior
The sourceFeature.canBeLine() should return false or update the docs to reflect that.
Additional context
I can use
f.canBeLine() && f.!canBePolygon()
to work around this issue, but I'm wondering this is a bug in the code or should I open a PR to update the doc comment...?The text was updated successfully, but these errors were encountered: