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
osmium time-filter - recreation of osc files based on history dump #19
Comments
Yes, a misunderstanding. What What you are trying to do can't be done with current osmium-tool, but it should be easy to do with a small libosmium program. Or you can call As a side note: you didn't have to use |
Thank you for your detailed reply. I have to say that I really misunderstood time-filter. One thing I don't quite get is the difference between the following two statements: "is create a file that contains all the data needed for re-creating the state of the planet at any point in time in this time range." vs. "Just beware that this will not give you all the changes between those points in time, because for multiple intermediate changes only the last one will appear." My question is basically, where this restriction "multiple intermediate changes only the last one will appear." comes from. Is this something inherit to I experimented a bit with DiffObject and added a new method there, which I also called from osmium time-filter. bool is_only_between(const osmium::Timestamp& from, const osmium::Timestamp& to) const noexcept {
return (from <= start_time() && start_time() < to) &&
((start_time() != end_time() && (end_time() > from && to < end_time()));
} Unfortunately, I really only got the last version in the given timeframe. So for the purpose of creating .osc files with all versions, which I want to feed into Overpass API, I really need to go ahead with the plain vanilla libosmium approach, as you suggested. As I have absolutely no experience with this library, this is going to be a bit of a learning curve. I wonder if the overall requirement to recreate .osc files based on .osh.* files is worthwhile including in osmium-contrib? |
If you use time-filter with a range you will get all changes in between those times. But if you call time-filter twice, each time with a different point in time and then create the diff you will loose multiple changes. That is inherent to the "call it twice" approach. Yes, this could be something for osmium-contrib. |
I tried the following quick hack to split a full history file into daily chunks of osh.pbf files based on an object's timestamp . Although this seemed to work once the number of files has been increased ( https://github.com/mmd-osm/libosmium/commit/6884726271018126c8eccaea01a6ea071fa438a0 |
The issue I'm looking at is to recreate .osc files based on an existing history dump. Instead of creating a huge .osc file based on several years of history, the idea came up to split the history file into smaller chunks and create .osc files based on them, say with 1 day or 1 week granularity. The following thread on the Overpass API dev list gives some more context, but that's optional reading.
I somehow got the impression that
osmium time-filter
could be used to extract all changes pertaining to a certain timeframe. I tried the following command:osmium time-filter -o swiss_diff.osh.pbf switzerland-padded-softcut.osh.pbf 2015-01-01T00:00:00Z 2015-01-07T00:00:00Z
... followed by a
osmconvert swiss_diff.osh.pbf --out-osc
.Unfortunately, the resulting .osc file contains data outside of the specified timeframe:
I'm not sure if I'm somehow misunderstanding what
osmium time-filter
is supposed to do on .osh.pbf files. I checked the man page, but somehow I couldn't figure out, what If both FROM-TIME and TO-TIME are given, the result will also have history data is supposed to mean related to my question.Original file location: http://planet.osm.ch/history/switzerland-padded-softcut.osh.pbf (521MB file size)
The text was updated successfully, but these errors were encountered: