only consider proper lifecycle tagging in "past/futures" layer (#10943)

fixes #10186, where features with e.g. `intermittent=yes` were incorrectly sorted into the past/futures layer

now only features with correct tagging are included in the "past/futures" layer:
* either the "legacy" lifecycle tagging (e.g. `highway=construction`)
* or proper lifecycle prefix tags (e.g. `disused:shop=convenience`)
This commit is contained in:
Martin Raifer
2025-04-17 12:47:10 +02:00
committed by GitHub
parent 95143219a2
commit afce723b74
3 changed files with 13 additions and 9 deletions
+2
View File
@@ -46,6 +46,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
* Show unchanged tags of a [deprecation rule](https://github.com/ideditor/schema-builder?tab=readme-ov-file#deprecations) explicitly in the validation warning ([#10104])
#### :bug: Bugfixes
* Fix removed tooltips from re-appearing when using keyboard navigation ([#9873])
* Only consider feature with proper lifecycle tags in "past/futures" layer ([#10943])
#### :earth_asia: Localization
#### :hourglass: Performance
#### :mortar_board: Walkthrough / Help
@@ -55,6 +56,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
[#9873]: https://github.com/openstreetmap/iD/issues/9873
[#10104]: https://github.com/openstreetmap/iD/issues/10104
[#10943]: https://github.com/openstreetmap/iD/pull/10943
[#10946]: https://github.com/openstreetmap/iD/issues/10946
[#10959]: https://github.com/openstreetmap/iD/issues/10959
[#10966]: https://github.com/openstreetmap/iD/issues/10966
+6 -4
View File
@@ -223,10 +223,12 @@ export function rendererFeatures(context) {
const keys = Object.keys(tags);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
const s = key.split(':')[0];
if (osmLifecyclePrefixes[s] || osmLifecyclePrefixes[tags[key]]) return true;
for (const key of keys) {
if (osmLifecyclePrefixes[tags[key]]) return true; // legacy tagging, e.g. `highway=construction`
const parts = key.split(':');
if (parts.length === 1) continue;
const prefix = parts[0];
if (osmLifecyclePrefixes[prefix]) return true; // lifecycle tagging, e.g. `demolished:building=yes`
}
return false;
});
+5 -5
View File
@@ -58,7 +58,7 @@ describe('iD.rendererFeatures', function() {
iD.osmNode({id: 'point_dock', tags: {waterway: 'dock'}, version: 1}),
iD.osmNode({id: 'point_rail_station', tags: {railway: 'station'}, version: 1}),
iD.osmNode({id: 'point_generator', tags: {power: 'generator'}, version: 1}),
iD.osmNode({id: 'point_old_rail_station', tags: {railway: 'station', disused: 'yes'}, version: 1}),
iD.osmNode({id: 'point_old_rail_station', tags: {'disused:railway': 'station'}, version: 1}),
iD.osmWay({id: 'motorway', tags: {highway: 'motorway'}, version: 1}),
iD.osmWay({id: 'building_yes', tags: {area: 'yes', amenity: 'school', building: 'yes'}, version: 1}),
iD.osmWay({id: 'boundary', tags: {boundary: 'administrative'}, version: 1}),
@@ -80,7 +80,7 @@ describe('iD.rendererFeatures', function() {
expect(stats.paths).to.eql(0);
expect(stats.points).to.eql(5);
expect(stats.power).to.eql(1);
expect(stats.rail).to.eql(2);
expect(stats.rail).to.eql(1);
expect(stats.water).to.eql(1);
});
});
@@ -92,7 +92,7 @@ describe('iD.rendererFeatures', function() {
iD.osmNode({id: 'point_dock', tags: {waterway: 'dock'}, version: 1}),
iD.osmNode({id: 'point_rail_station', tags: {railway: 'station'}, version: 1}),
iD.osmNode({id: 'point_generator', tags: {power: 'generator'}, version: 1}),
iD.osmNode({id: 'point_old_rail_station', tags: {railway: 'station', disused: 'yes'}, version: 1}),
iD.osmNode({id: 'point_old_rail_station', tags: {'disused:railway': 'station'}, version: 1}),
// Traffic Roads
iD.osmWay({id: 'motorway', tags: {highway: 'motorway'}, version: 1}),
@@ -472,12 +472,12 @@ describe('iD.rendererFeatures', function() {
features.gatherStats(all, graph, dimensions);
doMatch('rail', [
'point_rail_station', 'point_old_rail_station',
'railway', 'rail_landuse', 'rail_disused'
'point_rail_station', 'railway', 'rail_landuse', 'rail_disused'
]);
dontMatch('rail', [
'rail_streetcar', 'rail_trail', // because rail also used as highway
'point_old_rail_station',
'point_bar', 'motorway', 'service', 'path', 'building_yes',
'forest', 'boundary', 'boundary_member', 'water', 'power_line',
'motorway_construction', 'fence'