Consider lifecycle prefixed tags in Future/Past features (#10228)

and sharpen landuse filter
This commit is contained in:
Dimitar
2024-06-05 15:47:19 +03:00
committed by GitHub
parent 94a55434bb
commit b2fc4a43c0
3 changed files with 18 additions and 8 deletions
+3
View File
@@ -50,6 +50,8 @@ _Breaking developer changes, which may affect downstream projects or sites that
* Fix bug which required a second button click when resolving/reopening of OSM notes ([#8994], thanks [@laigyu])
* Fix API URLs for ImproveOSM QA service ([#9993], thanks [@k-yle])
* Fix icons with inline css styles not properly being displayed on osm.org
* Properly sort map features with lifecycle prefixes in the _Past/Futures_ features ([#7582])
* Only consider features with either `landuse`, `natural`, `amentiy` or `leisure` tag to be classified as _Landuse_ areas
#### :earth_asia: Localization
#### :hourglass: Performance
#### :mortar_board: Walkthrough / Help
@@ -60,6 +62,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
* Update dependencies, including `osm-community-index` to v5.7, `osm-auth` to v2.5
[#3595]: https://github.com/openstreetmap/iD/issues/3595
[#7582]: https://github.com/openstreetmap/iD/issues/7582
[#8994]: https://github.com/openstreetmap/iD/issues/8994
[#9993]: https://github.com/openstreetmap/iD/issues/9993
[#10181]: https://github.com/openstreetmap/iD/pull/10181
+12 -6
View File
@@ -132,7 +132,12 @@ export function rendererFeatures(context) {
});
defineRule('landuse', function isLanduse(tags, geometry) {
return geometry === 'area' &&
return geometry === 'area' && (
!!tags.landuse ||
!!tags.natural ||
!!tags.leisure ||
!!tags.amenity
) &&
!_rules.buildings.filter(tags) &&
!_rules.building_parts.filter(tags) &&
!_rules.indoor.filter(tags) &&
@@ -188,7 +193,7 @@ export function rendererFeatures(context) {
return tags['piste:type'];
});
defineRule('aerialways', function isPiste(tags) {
defineRule('aerialways', function isAerialways(tags) {
return tags.aerialway &&
tags.aerialway !== 'yes' &&
tags.aerialway !== 'station';
@@ -206,11 +211,12 @@ export function rendererFeatures(context) {
paths[tags.highway]
) { return false; }
var strings = Object.keys(tags);
const keys = Object.keys(tags);
for (var i = 0; i < strings.length; i++) {
var s = strings[i];
if (osmLifecyclePrefixes[s] || osmLifecyclePrefixes[tags[s]]) return true;
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;
}
return false;
});
+3 -2
View File
@@ -152,6 +152,7 @@ describe('iD.rendererFeatures', function() {
iD.osmWay({id: 'scrub', tags: {area: 'yes', natural: 'scrub'}, version: 1}),
iD.osmWay({id: 'industrial', tags: {area: 'yes', landuse: 'industrial'}, version: 1}),
iD.osmWay({id: 'parkinglot', tags: {area: 'yes', amenity: 'parking', parking: 'surface'}, version: 1}),
iD.osmWay({id: 'park', tags: {area: 'yes', leisure: 'park', parking: 'surface'}, version: 1}),
// Landuse Multipolygon
iD.osmWay({id: 'outer', version: 1}),
@@ -550,13 +551,13 @@ describe('iD.rendererFeatures', function() {
});
it('hides uninteresting (e.g. untagged or "other") member ways on a hidden multipolygon relation', function() {
var outer = iD.osmWay({id: 'outer', tags: {area: 'yes', natural: 'wood'}, version: 1});
var outer = iD.osmWay({id: 'outer', tags: {}, version: 1});
var inner1 = iD.osmWay({id: 'inner1', tags: {barrier: 'fence'}, version: 1});
var inner2 = iD.osmWay({id: 'inner2', version: 1});
var inner3 = iD.osmWay({id: 'inner3', tags: {highway: 'residential'}, version: 1});
var r = iD.osmRelation({
id: 'r',
tags: {type: 'multipolygon'},
tags: {type: 'multipolygon', natural: 'wood'},
members: [
{id: outer.id, role: 'outer', type: 'way'},
{id: inner1.id, role: 'inner', type: 'way'},