NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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

accept rate: 11%

edited 18 Nov '13, 04:41

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.

permanent link

answered 18 Nov '13, 14:47

Pieren's gravatar image

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 ♦

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
permanent link

answered 10 Aug '15, 00:46

mvexel's gravatar image

accept rate: 0%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 15 Nov '13, 04:54

question was seen: 5,314 times

last updated: 10 Aug '15, 00:46

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum