GIScience / ohsome-api

API for analysing OpenStreetMap history data
https://api.ohsome.org
GNU Affero General Public License v3.0
47 stars 8 forks source link

fix contributions extraction endpoints for non-final deletions #324

Closed tyrasd closed 5 months ago

tyrasd commented 8 months ago

This is the case when a deletion happens which was reverted later on. These "deletion" contributions are currently missing in the output of /contributions extraction endpoints.

For example curl -X GET "https://api.ohsome.org/v1/contributions/geometry?bboxes=-180%2C-90%2C180%2C90&clipGeometry=true&filter=type%3Anode%20and%20id%3A1&properties=tags%2CcontributionTypes&time=2009-01-01%2C2012-01-01" -H "accept: application/json", for node/1 one gets:

  …
  }, {
    "type" : "Feature",
    "geometry" : {
      "type" : "Point",
      "coordinates" : [
        2.0,
        2.0
      ]
    },
    "properties" : {
      "@contributionChangesetId" : 524633,
      "@geometryChange" : true,
      "@osmId" : "node/1",
      "@tagChange" : true,
      "@timestamp" : "2009-04-14T15:42:57Z"
    }
  }, {
    "type" : "Feature",
    "geometry" : {
      "type" : "Point",
      "coordinates" : [
        9.4317166,
        51.2492152
      ]
    },
    "properties" : {
      "@contributionChangesetId" : 9035746,
      "@geometryChange" : true,
      "@osmId" : "node/1",
      "@timestamp" : "2011-08-16T11:26:47Z"
    }
  }, {
  …

Note that there is no contribution on 2009-07-07T22:44:41Z, corresponding to version 4 of the node. This would be the expected result:

  …
  }, {
    "type" : "Feature",
    "geometry" : {
      "type" : "Point",
      "coordinates" : [
        2.0,
        2.0
      ]
    },
    "properties" : {
      "@contributionChangesetId" : 524633,
      "@geometryChange" : true,
      "@osmId" : "node/1",
      "@tagChange" : true,
      "@timestamp" : "2009-04-14T15:42:57Z"
    }
  }, {
    "type" : "Feature",
    "geometry" : null,
    "properties" : {
      "@contributionChangesetId" : 1767082,
      "@deletion" : true,
      "@osmId" : "node/1",
      "@timestamp" : "2009-07-07T22:44:41Z"
    }
  }, {
    "type" : "Feature",
    "geometry" : {
      "type" : "Point",
      "coordinates" : [
        9.4317166,
        51.2492152
      ]
    },
    "properties" : {
      "@contributionChangesetId" : 9035746,
      "@geometryChange" : true,
      "@osmId" : "node/1",
      "@timestamp" : "2011-08-16T11:26:47Z"
    }
  }, {
  …

Checklist