From e07dcddfee4c26e4f8e59b967cb0ac96bc619b5a Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Thu, 5 Jun 2025 14:34:11 +0200 Subject: [PATCH] only render addr point markers when there are addr tags closes #11092 and also skip rendering of "placement ellipse" for address points --- modules/svg/labels.js | 11 ++++++----- modules/svg/points.js | 6 +++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/modules/svg/labels.js b/modules/svg/labels.js index a80d29c9b..1727800ba 100644 --- a/modules/svg/labels.js +++ b/modules/svg/labels.js @@ -792,11 +792,12 @@ const nonPrimaryKeys = new Set([ ]); const nonPrimaryKeysRegex = /^(ref|survey|note):/; export function isAddressPoint(tags) { - const keys = Object.keys(tags); + const keys = Object.keys(tags).filter(key => + osmIsInterestingTag(key) && + !nonPrimaryKeys.has(key) && + !nonPrimaryKeysRegex.test(key) + ); return keys.length > 0 && keys.every(key => - key.startsWith('addr:') || - !osmIsInterestingTag(key) || - nonPrimaryKeys.has(key) || - nonPrimaryKeysRegex.test(key) + key.startsWith('addr:') ); } diff --git a/modules/svg/points.js b/modules/svg/points.js index 618c6c453..362ca0301 100644 --- a/modules/svg/points.js +++ b/modules/svg/points.js @@ -1,5 +1,6 @@ import deepEqual from 'fast-deep-equal'; import { clamp } from 'lodash-es'; +import { select as d3_select } from 'd3'; import { geoScaleToZoom } from '../geo'; import { osmEntity } from '../osm'; @@ -121,13 +122,16 @@ export function svgPoints(projection, context) { .append('path') .call(markerPath, 'shadow'); - enter + enter.each(function(d) { + if (isAddressPoint(d.tags)) return; + d3_select(this) .append('ellipse') .attr('cx', 0.5) .attr('cy', 1) .attr('rx', 6.5) .attr('ry', 3) .attr('class', 'stroke'); + }); enter .append('path')