Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to search objects in a changeset ? #162

Open
pyrog opened this issue Dec 18, 2014 · 10 comments
Open

Is it possible to search objects in a changeset ? #162

pyrog opened this issue Dec 18, 2014 · 10 comments

Comments

@pyrog
Copy link

pyrog commented Dec 18, 2014

I would like to search all or some object in a changeset.

<osm-script>
  <id-query ref="507464799" type="changeset"/>
  <print/>
</osm-script>

Is it possible with Overpass ?

@mmd-osm
Copy link
Contributor

mmd-osm commented Dec 18, 2014

First of all: filtering on or querying of changesets is not possible at this time.

Maybe you should check out achavi, which works with a combination of OSM main db and overpass:

Example: http://nrenner.github.io/achavi/?changeset=27183569

Step 1: Request Changeset metadata

http://www.openstreetmap.org/api/0.6/changeset/27183569

Result:

<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="OpenStreetMap server" copyright="OpenStreetMap and contributors" attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/">
  <changeset id="27183569" user="FahRadler" uid="344561" created_at="2014-12-02T16:36:28Z" closed_at="2014-12-02T17:40:02Z" open="false" min_lat="49.2351097" min_lon="6.7306185" max_lat="49.2734277" max_lon="6.7979623" comments_count="0">
    <tag k="source" v="Bing"/>
    <tag k="created_by" v="JOSM/1.5 (7643 de)"/>
    <tag k="comment" v="Addition from Bing / Fieldwork"/>
  </changeset>
</osm>

Step 2: Use changeset metadata to request changes in bbox in this timeframe

bbox -> 6.7306185,49.2351097,6.7979623,49.2734277
data -> [adiff:"2014-12-02T16:36:27Z","2014-12-02T17:40:02Z"];(node(bbox)(changed);way(bbox)(changed););out meta geom(bbox);

I believe this is not 100% accurate if some other user happens to do some changes in the same timeframe/bbox, as overpass will only return the last change in that timeframe. Maybe @nrenner can comment on this?

In addition to that, @drolbr is also working on tool support in this area iirc, but this is not yet (officially) available.

@pyrog
Copy link
Author

pyrog commented Dec 18, 2014

Thanks 😄
I didn't know before neither AChaVi, neither Attic data or diff/adiff.

First of all: filtering on or querying of changesets is not possible at this time.

But technically it is possible with date settings ? So maybe Roland could implement search by chanegeset in the future ?

 [date:"2012-09-14T15:00:00Z"]

@mmd-osm
Copy link
Contributor

mmd-osm commented Dec 18, 2014

The problem with date is, that a changeset usually covers a timeframe of several seconds to hours with a number of changes (could be up to 2000 iirc). Date however looks at a point in time only.

Details for a single changeset are already provided by the main api: example http://www.openstreetmap.org/api/0.6/changeset/27183569/download (takes a while to load).

I still don't know what your use case is, could you elaborate a bit more, giving some more concrete examples?

@nrenner
Copy link

nrenner commented Dec 19, 2014

Step 3 in achavi is to filter the result by the changeset id, including referenced objects.

I believe this is not 100% accurate if some other user happens to do some changes in the same timeframe/bbox, as overpass will only return the last change in that timeframe.

You're right, this does not really work when an object is modified by multiple changesets in the same timeframe/bbox. Don't know how often this actually occurs and what to do about it.

@pyrog
Copy link
Author

pyrog commented Dec 19, 2014

I still don't know what your use case is, could you elaborate a bit more, giving some more concrete examples?

I have made a changeset that was reversed. I would like to get the iDs of theses objects to build some queries : how many objects by country with tags xx=yy, and so on…

I could do that with JOSM (with the reverse changeset plugin) but I prefer to make a query with Overpass turbo (see map and see datas in XML without the risk to alter them).

@kolesar-andras
Copy link

Would be possible to filter objects by changeset id? Similar to user or type filter:

changeset:1234567

This data is available for overpass, returns with objects. Related to #189.

@drolbr
Copy link
Owner

drolbr commented Jul 18, 2018

There is now the evaluator changeset that solves part of the problem.

@mmd-osm
Copy link
Contributor

mmd-osm commented Dec 28, 2018

It seems as if the changeset evaluator won’t return deleted objects in the adiff case.

@nrenner
Copy link

nrenner commented Jan 3, 2019

I think such metadata filters (like also user/uid) don't make sense with adiff (when applied at both timestamps).

The whole diff doesn't work with if:changeset(), as the query at the start timestamp doesn't match anything. See e.g. changesets 65944681 and 65908097. For modified objects, the old object is empty and has just the meta data - no tags, coordinates or node refs:

  <action type="modify">
  <old>
    <node id="1695993595" version="1" timestamp="2012-03-29T10:41:41Z" changeset="11135386" uid="641152" user="Gui!"/>
  </old>
  <new>
    <node id="1695993595" lat="48.9900248" lon="2.3607126" version="2" timestamp="2019-01-01T22:48:52Z" changeset="65944681" uid="6590084" user="jean-normandie">
      <tag k="amenity" v="restaurant"/>
      <tag k="cuisine" v="italian"/>
      <tag k="name" v="Pizza Hut"/>
    </node>
  </new>
  </action>

Actually, I thought action type create would be returned when the query doesn't match at the start timestamp. Has this changed or am I confusing things?

@mmd-osm
Copy link
Contributor

mmd-osm commented Jan 3, 2019

Has this changed or am I confusing things?

Very good point. I think I was tricked by the <old> tag that this might work, but as you point out, it doesn't really make sense at all. Even worse, the behavior changed between 0.7.54 and 0.7.55:

NB: I had to change (if:changeset() == ...) to a tag query, as the query wouldn't run on 0.7.54 otherwise.

Query

[bbox:48.9900248,2.3607126,48.9900248,2.3607126]
[adiff:"2019-01-01T22:48:51Z","2019-01-01T22:48:52Z"];
node[cuisine];
out meta geom;

0.7.54: (//dev.overpass-api.de/api_drolbr/)

<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="Overpass API 0.7.54.13 ff15392f">
<note>The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.</note>
<meta osm_base="2019-01-03T15:02:02Z"/>

  <bounds minlat="48.9900248" minlon="2.3607126" maxlat="48.9900248" maxlon="2.3607126"/>

<action type="create">
  <node id="1695993595" lat="48.9900248" lon="2.3607126" version="2" timestamp="2019-01-01T22:48:52Z" changeset="65944681" uid="6590084" user="jean-normandie">
    <tag k="amenity" v="restaurant"/>
    <tag k="cuisine" v="italian"/>
    <tag k="name" v="Pizza Hut"/>
  </node>
</action>

</osm>

0.7.55: (//lz4.overpass-api.de/api/)

<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="Overpass API 0.7.55.5 2ca3f387">
<note>The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.</note>
<meta osm_base="2019-01-03T15:07:02Z"/>

  <bounds minlat="48.9900248" minlon="2.3607126" maxlat="48.9900248" maxlon="2.3607126"/>

<action type="modify">
<old>
  <node id="1695993595" version="1" timestamp="2012-03-29T10:41:41Z" changeset="11135386" uid="641152" user="Gui!"/>
</old>
<new>
  <node id="1695993595" lat="48.9900248" lon="2.3607126" version="2" timestamp="2019-01-01T22:48:52Z" changeset="65944681" uid="6590084" user="jean-normandie">
    <tag k="amenity" v="restaurant"/>
    <tag k="cuisine" v="italian"/>
    <tag k="name" v="Pizza Hut"/>
  </node>
</new>
</action>

</osm>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants