[OSM-dev] using Osmium to filter osh files

Jochen Topf jochen at remote.org
Thu May 22 12:40:55 UTC 2014


On Mi, Mai 21, 2014 at 11:20:18 -0400, Abhishek wrote:
> I would like to use osmium to filter .osh files. Specifically I wanted
> to recreate the features of osmfilter, that allows me extract certain
> features like "amenity=*" or "highway=*" along with their relevant
> histories from a .osh.pbf file.
> 
> I've managed to successsfully setup osmium and osmium-tool, but I
> couldnt figure out a way to use these tools to filter features from
> the history data. I'm very new to writing code in C++, so I was hoping
> this feature was implemented. Any ideas on where I should be looking
> for help?

Working with the history files is not easy and it very much depends on what you
really want to do. In the general case, it is not enough to find, for instance,
all ways tagged with highway=*, you have to find the nodes that were used by
those ways at the time when those ways were current. If you are only interested
in the tags and their history and not the location of those ways, it becomes
much easier. So first, you have to understand the details of the OSM data model
and how it plays out in the history files.

Osmium has many building blocks that you will need, it can read the history
files, there are tag filter classes (osmium::tags::KeyFilter and
osmium::tags::KeyValueFilter) and ways to store and index data. But there
is no easy recipe.

Maybe you can tell us a bit more about what you want to accomplish in the end
and we can have more tips for you then.

Jochen
-- 
Jochen Topf  jochen at remote.org  http://www.jochentopf.com/  +49-721-388298



More information about the dev mailing list