diff --git a/CHANGELOG.md b/CHANGELOG.md index 88cfe27d1..bf2451eff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ _Breaking developer changes, which may affect downstream projects or sites that * Show turn restriction editor also when there is only one possible "to" way, as there might exist restrictions with that way as _via_ ([#9983]) * Local photos: Fix bug which prevented the last image from being removed from the map when removed from the list * Fix wrong mouse cursor on "foreign link" field buttons (for example in the Mapillary or Wikimedia Commons fields) ([#9992], thanks [@ramith-kulal]) +* Don't show duplicates of notes when they lie exactly on special locations like null island (0.0,0.0) #### :earth_asia: Localization #### :hourglass: Performance #### :mortar_board: Walkthrough / Help diff --git a/modules/services/osm.js b/modules/services/osm.js index 30fdb0b72..504c6ae2d 100644 --- a/modules/services/osm.js +++ b/modules/services/osm.js @@ -389,15 +389,20 @@ var parsers = { props.loc = getLoc(attrs); // if notes are coincident, move them apart slightly - var coincident = false; - var epsilon = 0.00001; - do { - if (coincident) { - props.loc = geoVecAdd(props.loc, [epsilon, epsilon]); - } - var bbox = geoExtent(props.loc).bbox(); - coincident = _noteCache.rtree.search(bbox).length; - } while (coincident); + if (!_noteCache.note[uid]) { + let coincident = false; + const epsilon = 0.00001; + do { + if (coincident) { + props.loc = geoVecAdd(props.loc, [epsilon, epsilon]); + } + const bbox = geoExtent(props.loc).bbox(); + coincident = _noteCache.rtree.search(bbox).length; + } while (coincident); + } else { + // we already saw this note: don't change its location again + props.loc = _noteCache.note[uid].loc; + } // parse note contents for (var i = 0; i < childNodes.length; i++) { @@ -416,7 +421,7 @@ var parsers = { var note = new osmNote(props); var item = encodeNoteRtree(note); _noteCache.note[note.id] = note; - _noteCache.rtree.insert(item); + updateRtree(item, true); return note; },