This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Filter out data that have been edited after some timestamp

3

I want to get data after some timestamp. I have downloaded the osm file of the area. I went through the osmosis documentation but could not find a way to filter it by time.

The result should be same as when we use the timestamp:sometime in JOSM.

  1. I could use JOSM but copy pasting in new layer removes old id ad gives new id, also
  2. i could use the overpass but the area is large and overpass timed out many times

asked 15 Nov '13, 04:54

amritkarma's gravatar image

amritkarma
684212941
accept rate: 11%

edited 18 Nov '13, 04:41


2 Answers:

1

In JOSM, instead of selecting new objects with "timestamp:sometime" and copy them to a new layer loosing their Id's, you could try the opposite: select old objects with "-timestamp:sometime" (the "-" is the reverse option) and delete all of them. Thus, only the most recent elements are staying and you preserve the Id's. But I'm not able to test this method right now, I'm not sure if it works.

answered 18 Nov '13, 14:47

Pieren's gravatar image

Pieren
9.8k2083157
accept rate: 15%

They would not be deleted immidiately. They would be marked for deletion and don't show up in josm but they will still exist in the osm file.

(18 Nov '13, 15:04) amritkarma

Is this a problem? You could just ignore any element with action='delete' when parsing the XML file.

(18 Nov '13, 16:33) scai ♦

JOSM can also discard data altogehter ("purge") instead of flagging it as deleted.

(19 Nov '13, 13:33) Frederik Ramm ♦

1

For anyone looking to do this on a larger dataset, my approach would be to load the data into PostgreSQL

osmosis --rbf large.osm.pbf --wp database=osm

Then drop everything that was last touched before / after your desired horizon:

DELETE FROM nodes WHERE tstamp < date '2015-07-01;
DELETE FROM ways WHERE tstamp < date '2015-07-01;
DELETE FROM relations WHERE tstamp < date '2015-07-01;

Then dump the data to PBF again:

osmosis --rp database=osm --dd --wb after-20150701.osm.pbf

answered 10 Aug '15, 00:46

mvexel's gravatar image

mvexel
76281523
accept rate: 0%

Source code available on GitHub .