drolbr / Overpass-API

A database engine to query the OpenStreetMap data.
http://overpass-api.de
GNU Affero General Public License v3.0
690 stars 90 forks source link

Same element appears twice in adiff output #712

Open zstadler opened 7 months ago

zstadler commented 7 months ago

When running the following adiff query (try it on Overpass Turbo)

[adiff:
 "2023-10-01T00:00:00Z",
 "2023-11-01T00:00:00Z"];
way
  (32.09611804750574,
   34.77323055267335,
   32.097399712763256,
   34.77997899055482);
compare(delta:1);
out meta geom;

The output contains two actions for <way id="42561699". (See its OSM history) One action has type="modify" and the other has type="delete", as listed below.

Several observations:

  1. IMO, the way should not be included in the output as the element existed on both dates
  2. If a smaller bbox is used, the problem disappears

output snippets

<action type="modify">

<action type="modify">
<old>
  <way id="42561699" version="7" timestamp="2023-06-14T12:58:19Z" changeset="137327819" uid="1298075" user="Sokuya">
    <bounds minlat="32.0965915" minlon="34.7732989" maxlat="32.0972719" maxlon="34.7737627"/>
    <nd ref="558792806" lat="32.0972719" lon="34.7734611"/>
    <nd ref="558792808" lat="32.0972157" lon="34.7737627"/>
    <nd ref="531617012" lat="32.0965915" lon="34.7736007"/>
    <nd ref="531617011" lat="32.0966478" lon="34.7732989"/>
    <nd ref="558792806" lat="32.0972719" lon="34.7734611"/>
    <tag k="building" v="yes"/>
    <tag k="name" v="האנגר 8"/>
    <tag k="name:en" v="Hangar 8"/>
    <tag k="name:he" v="האנגר 8"/>
  </way>
</old>
<new>
  <way id="42561699" version="13" timestamp="2023-10-30T01:35:38Z" changeset="143337015" uid="1778799" user="SomeoneElse_Revert">
    <bounds minlat="32.0965915" minlon="34.7732989" maxlat="32.0972719" maxlon="34.7737627"/>
    <nd ref="558792806" lat="32.0972719" lon="34.7734611"/>
    <nd ref="558792808" lat="32.0972157" lon="34.7737627"/>
    <nd ref="531617012" lat="32.0965915" lon="34.7736007"/>
    <nd ref="531617011" lat="32.0966478" lon="34.7732989"/>
    <nd ref="558792806" lat="32.0972719" lon="34.7734611"/>
    <tag k="building" v="yes"/>
    <tag k="name" v="האנגר 8"/>
    <tag k="name:en" v="Hangar 8"/>
    <tag k="name:he" v="האנגר 8"/>
  </way>
</new>
</action>

<action type="delete">

<action type="delete">
<old>
  <way id="42561699" version="7" timestamp="2023-06-14T12:58:19Z" changeset="137327819" uid="1298075" user="Sokuya">
    <bounds minlat="32.0965915" minlon="34.7732989" maxlat="32.0972719" maxlon="34.7737627"/>
    <nd ref="558792806" lat="32.0972719" lon="34.7734611"/>
    <nd ref="558792808" lat="32.0972157" lon="34.7737627"/>
    <nd ref="531617012" lat="32.0965915" lon="34.7736007"/>
    <nd ref="531617011" lat="32.0966478" lon="34.7732989"/>
    <nd ref="558792806" lat="32.0972719" lon="34.7734611"/>
    <tag k="building" v="yes"/>
    <tag k="name" v="האנגר 8"/>
    <tag k="name:en" v="Hangar 8"/>
    <tag k="name:he" v="האנגר 8"/>
  </way>
</old>
<new>
  <way id="42561699" visible="true" version="13" timestamp="2023-10-30T01:35:38Z" changeset="143337015" uid="1778799" user="SomeoneElse_Revert"/>
</new>
</action>
mmd-osm commented 7 months ago

Below I've added a simpler test case, which returns the way twice, at least on the main instance, and on kumi.systems.

On instances where the way doesn't appear twice (e.g. //overpass.osmcha.org/api/), also the query posted by OP doesn't include way 42561699.

Seeing two ways in the following query seems to be a prerequisite for the issue.

[date:"2023-10-01T00:00:00Z"];
way(42561699);
out meta;

Also timeline shows the duplicate version number:

timeline(way,42561699);
for (t["created"])
{
  retro (_.val)
  {
    way(42561699);
    out meta;
  }
}