forked from tyrasd/latest-changes
-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
In rare edge cases the reference to an old node in a way might be missing in the overpass data which leads to osmtogeojson returning Null coordinates. The creation of the Leaflet layer will fail when Null coordinates are present ('Error: Invalid LatLng object: (NaN, NaN)'). Thus we filter them out here.
Below is an example xml file which has been fetched from Overpass. Node 5727511182 does not have coordinates in 'old' which leads to the problem described above.
The URL for the fetch operation (executed on 2025-09-17):
//overpass-api.de/api/interpreter?data=[adiff:"2025-09-11T08:43:22.662Z"][bbox:3.0536109101148834,101.66370391845703,3.2726597794868226,101.75966262817383][out:xml];nw;out geom meta;
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="Overpass API 0.7.62.8 e802775f">
<note>The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.</note>
<meta osm_base="2025-09-18T08:46:02Z"/>
<bounds minlat="3.0536109" minlon="101.6637039" maxlat="3.2726598" maxlon="101.7596626"/>
<action type="modify">
<old>
<node id="5727511182" version="2" timestamp="2021-06-20T10:24:00Z" changeset="106660165" uid="536853" user="kucai"/>
</old>
<new>
<node id="5727511182" lat="3.0536153" lon="101.6768518" version="3" timestamp="2025-09-15T15:40:59Z" changeset="171972843" uid="536853" user="kucai"/>
</new>
</action>
<action type="modify">
<old>
<way id="603261112" version="2" timestamp="2021-06-20T10:24:00Z" changeset="106660165" uid="536853" user="kucai"/>
</old>
<new>
<way id="603261112" version="2" timestamp="2021-06-20T10:24:00Z" changeset="106660165" uid="536853" user="kucai">
<bounds minlat="3.0533276" minlon="101.6767734" maxlat="3.0536153" maxlon="101.6768540"/>
<nd ref="5727511179" lat="3.0533276" lon="101.6767734"/>
<nd ref="8850061510" lat="3.0533653" lon="101.6767942"/>
<nd ref="8850061509" lat="3.0534253" lon="101.6768341"/>
<nd ref="8850061508" lat="3.0534966" lon="101.6768533"/>
<nd ref="8850061507" lat="3.0535337" lon="101.6768540"/>
<nd ref="5727511182" lat="3.0536153" lon="101.6768518"/>
<tag k="highway" v="secondary_link"/>
<tag k="oneway" v="yes"/>
</way>
</new>
</action>
<!-- the way below has moved outside the bounding box from 'old' to 'new', so 'delete' equals 'no longer within the bounding box'. 'visible=true' means it is the latest version and currently part of the OSM dataset -->
<action type="delete">
<old>
<way id="1284772882" version="1" timestamp="2024-05-20T03:58:12Z" changeset="151558788" uid="9658463" user="GrabMY_ainayusof">
<bounds minlat="3.0522383" minlon="101.6749164" maxlat="3.0566068" maxlon="101.6779516"/>
<nd ref="8004523276" lat="3.0522383" lon="101.6779516"/>
<nd ref="268305898" lat="3.0525053" lon="101.6776561"/>
<nd ref="268305899" lat="3.0527965" lon="101.6774041"/>
<nd ref="5727511176" lat="3.0532286" lon="101.6770886"/>
<nd ref="1546903181" lat="3.0533580" lon="101.6769961"/>
<nd ref="2195278862" lat="3.0534167" lon="101.6769642"/>
<!-- The node 5727511182 below does not belong to this way in the latest version (v3). Somehow osmtogeojson thus cannot convert it and returns NaN. -->
<nd ref="5727511182" lat="3.0536056" lon="101.6768371"/>
<nd ref="8004523281" lat="3.0538748" lon="101.6766592"/>
<nd ref="11301594879" lat="3.0540973" lon="101.6765156"/>
<nd ref="5727511167" lat="3.0548908" lon="101.6760032"/>
<nd ref="1349426493" lat="3.0549849" lon="101.6759408"/>
<nd ref="1466900447" lat="3.0559648" lon="101.6753106"/>
<nd ref="11637406903" lat="3.0562753" lon="101.6750938"/>
<nd ref="5727511185" lat="3.0566068" lon="101.6749164"/>
<tag k="alt_name" v="Jalan Jalil Perkasa 1"/>
<tag k="highway" v="secondary"/>
<tag k="lanes" v="2"/>
<tag k="name" v="Jalan Jalil Perkasa 1"/>
<tag k="oneway" v="yes"/>
<tag k="surface" v="asphalt"/>
</way>
</old>
<new>
<way id="1284772882" visible="true" version="3" timestamp="2025-09-15T15:40:59Z" changeset="171972843" uid="536853" user="kucai"/>
</new>
</action>
<action type="create">
<way id="1429184943" version="3" timestamp="2025-09-15T15:50:32Z" changeset="171973397" uid="536853" user="kucai">
<bounds minlat="3.0534133" minlon="101.6749164" maxlat="3.0566068" maxlon="101.6769837"/>
<nd ref="2195278862" lat="3.0534133" lon="101.6769837"/>
<nd ref="5727511182" lat="3.0536153" lon="101.6768518"/>
<nd ref="8004523281" lat="3.0538849" lon="101.6766745"/>
<nd ref="11301594879" lat="3.0541062" lon="101.6765290"/>
<nd ref="5727511167" lat="3.0548952" lon="101.6760100"/>
<nd ref="1349426493" lat="3.0549896" lon="101.6759479"/>
<nd ref="1466900447" lat="3.0559568" lon="101.6753026"/>
<nd ref="11637406903" lat="3.0563195" lon="101.6750858"/>
<nd ref="5727511185" lat="3.0566068" lon="101.6749164"/>
<tag k="alt_name" v="Jalan Jalil Perkasa 1"/>
<tag k="highway" v="secondary"/>
<tag k="lanes" v="2"/>
<tag k="name" v="Jalan Jalil Perkasa 1"/>
<tag k="oneway" v="yes"/>
<tag k="surface" v="asphalt"/>
</way>
</action>
</osm>
Metadata
Metadata
Assignees
Labels
No labels