-
Notifications
You must be signed in to change notification settings - Fork 1.4k
#11775 Validation: Remove layer fixes for building overlaps; recommend level tags #11822
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,21 +89,36 @@ export function validationCrossingWays(context) { | |
| return true; | ||
| } | ||
|
|
||
| // assume 0 by default; don't use way.layer() since we account for structures here | ||
| var layer1 = tags1.layer || '0'; | ||
| var layer2 = tags2.layer || '0'; | ||
|
|
||
| if (allowsBridge(featureType1) && allowsBridge(featureType2)) { | ||
| if (hasTag(tags1, 'bridge') && !hasTag(tags2, 'bridge')) return true; | ||
| if (!hasTag(tags1, 'bridge') && hasTag(tags2, 'bridge')) return true; | ||
| // crossing bridges must use different layers | ||
| if (hasTag(tags1, 'bridge') && hasTag(tags2, 'bridge') && layer1 !== layer2) return true; | ||
| } else if (allowsBridge(featureType1) && hasTag(tags1, 'bridge')) return true; | ||
| else if (allowsBridge(featureType2) && hasTag(tags2, 'bridge')) return true; | ||
|
|
||
| if (allowsTunnel(featureType1) && allowsTunnel(featureType2)) { | ||
| if (hasTag(tags1, 'tunnel') && !hasTag(tags2, 'tunnel')) return true; | ||
| if (!hasTag(tags1, 'tunnel') && hasTag(tags2, 'tunnel')) return true; | ||
| // crossing tunnels must use different layers | ||
| if (hasTag(tags1, 'tunnel') && hasTag(tags2, 'tunnel') && layer1 !== layer2) return true; | ||
| } else if (allowsTunnel(featureType1) && hasTag(tags1, 'tunnel')) return true; | ||
| else if (allowsTunnel(featureType2) && hasTag(tags2, 'tunnel')) return true; | ||
|
|
||
| // don't flag crossing waterways and pier/highways | ||
| if (featureType1 === 'waterway' && featureType2 === 'highway' && tags2.man_made === 'pier') return true; | ||
| if (featureType2 === 'waterway' && featureType1 === 'highway' && tags1.man_made === 'pier') return true; | ||
|
|
||
| if (tags1.layer !== undefined && tags1.layer === tags2.layer) return false; // Warn if both have the same defined layer | ||
|
|
||
| const isElement1Bridge = allowsBridge(featureType1) && hasTag(tags1, 'bridge'); | ||
| const isElement2Bridge = allowsBridge(featureType2) && hasTag(tags2, 'bridge'); | ||
| if (isElement1Bridge !== isElement2Bridge) return true; // Either one is bridge, the other is not | ||
|
|
||
| const isElement1Tunnel = allowsTunnel(featureType1) && hasTag(tags1, 'tunnel'); | ||
| const isElement2Tunnel = allowsTunnel(featureType2) && hasTag(tags2, 'tunnel'); | ||
| if (isElement1Tunnel !== isElement2Tunnel ) return true; // Either one is tunnel, the other is not | ||
|
|
||
| return (tags1.layer || '0') !== (tags2.layer || '0'); | ||
| if (featureType1 === 'building' || featureType2 === 'building' || | ||
| taggedAsIndoor(tags1) || taggedAsIndoor(tags2)) { | ||
| // for building crossings, different layers are enough | ||
| if (layer1 !== layer2) return true; | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
|
|
||
|
|
@@ -404,6 +419,7 @@ export function validationCrossingWays(context) { | |
| allowsTunnel(featureType2) && hasTag(entities[1].tags, 'tunnel'); | ||
| var isCrossingBridges = allowsBridge(featureType1) && hasTag(entities[0].tags, 'bridge') && | ||
| allowsBridge(featureType2) && hasTag(entities[1].tags, 'bridge'); | ||
| var isBothBuildings = featureType1 === 'building' && featureType2 === 'building'; | ||
|
|
||
| var subtype = [featureType1, featureType2].sort().join('-'); | ||
|
|
||
|
|
@@ -475,8 +491,12 @@ export function validationCrossingWays(context) { | |
| featureType1 === 'building' || | ||
| featureType2 === 'building') { | ||
|
|
||
| fixes.push(makeChangeLayerFix('higher')); | ||
| fixes.push(makeChangeLayerFix('lower')); | ||
| // For overlapping buildings, do not suggest changing the `layer=*` tag. | ||
| // Vertically stacked buildings should use `level=*` instead. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. at least also here
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added the check if (!isBothBuildings) here to specifically disable the 'Make Higher' and 'Make Lower' layer buttons for building-to-building overlaps. By removing these buttons, we stop the editor from suggesting layer as an automated fix and encourage mappers to handle manual fix or fix the geometry. However, I've realized my current logic is a bit inconsistent since the validator still technically allows the tag, so I will review this and come up with proper implementation |
||
| if (!isBothBuildings) { | ||
| fixes.push(makeChangeLayerFix('higher')); | ||
| fixes.push(makeChangeLayerFix('lower')); | ||
| } | ||
|
|
||
| // can only add bridge/tunnel if both features are lines | ||
| } else if (context.graph().geometry(this.entityIds[0]) === 'line' && | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? If they are in fact vertically stacked buildings then
layeris appropriate.levelis for this on different levels (and BTW things on single level may be still vertically stacked)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is wiki advising this anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the Key:layer Wiki page advises for buildings in the final para :
'Ways in buildings... should be mostly described with level= instead of layer.'
After looking at the review, I've realized my current code logic is incomplete. While I've updated the message, the validation still incorrectly allows layer as a fix, which is inconsistent. As these changes were made some time ago, I’d like to take some time to properly review and adjust the implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it refers to ways in buildings, not to buildings themselves
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not entirely sure is
layer=proper solution of vertically stacked buildings*, butlevel=is surely not - as it refers to position within a building.*this is distinct form whether pushing mapper to add fake
layer=instead of fixing almost certainly bad geometries is appropriate - hiding "just add layers" when both are buildings makes sense to meThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand now. I’ll re-evaluate how overlapping building features should be handled in the validator and adjust the logic accordingly.