[OSM-dev] Filtering out elements from a planet extract
marqqs at gmx.eu
marqqs at gmx.eu
Wed Feb 8 21:19:45 GMT 2012
Hi Ciprian,
to use Osmium is certainly a good idea if you planning similar complex filtering tasks for the future!
If you want to try it with osmfilter, there are two ways:
1. Manipulate XML
Filter positive:
osmfilter input_data.osm --keep="landuse=" -o=filter_data.osm
Then manipulate the XML file by inserting a line "<delete>" right before the first node. Then apply this manipulated file to the original file:
osmconvert input_data.osm filter_data.osm -o=output_data.osm
(osmconvert will internally treat filter_data.osm as a changefile ".osc".)
2. Use Dependencies
I never tried it to this extend, but it should work. We assume that nodes may stay in the file IF (and only if) they are a member of a way (or relation) OR they have at least one own tag:
osmfilter input_data.osm --keep-nodes="*" --keep-ways-relations="landuse!=*" -o=output_data.osm
Markus
-------- Original-Nachricht --------
> Datum: Wed, 8 Feb 2012 22:53:58 +0200
> Von: Ciprian Talaba <cipriantalaba at gmail.com>
> An: marqqs at gmx.eu
> CC: dev at openstreetmap.org
> Betreff: Re: [OSM-dev] Filtering out elements from a planet extract
> Hi Markus,
>
> I am OK with removing all the nodes that are part of a landuse way no
> matter if they have their own tags or not. At least for now that will
> be enough.
>
> Thanks,
> Ciprian
>
> On Wed, Feb 8, 2012 at 10:38 PM, <marqqs at gmx.eu> wrote:
> > Hi Ciprian,
> >
> > sorry, I got you wrong.
> >
> > Now it's clear which ways you want to exclude, but I'm still not sure
> which nodes you want have and which nodes you don't.
> >
> > You want to exclude landuse-ways with all their nodes?
> > BUT you do NOT want to exclude that nodes of landuse-ways which have at
> least one node-owned tag?
> >
> > Markus
> >
> > -------- Original-Nachricht --------
> >> Datum: Wed, 8 Feb 2012 22:25:19 +0200
> >> Von: Ciprian Talaba <cipriantalaba at gmail.com>
> >> An: marqqs at gmx.eu
> >> CC: dev at openstreetmap.org
> >> Betreff: Re: [OSM-dev] Filtering out elements from a planet extract
> >
> >> Hi Markus,
> >>
> >> The scope is to keep everything BUT the landuse ways and corresponding
> >> nodes. I've tried like this:
> >>
> >> osmfilter32 input.o5m --drop-ways="landuse=" --out-o5m >output.o5m
> >>
> >> Thanks,
> >> --Ciprian
> >>
> >> On Wed, Feb 8, 2012 at 10:19 PM, <marqqs at gmx.eu> wrote:
> >> > Hi,
> >> >
> >> >> I then tried with osmfilter but I don't think I found the right way
> to
> >> >> do it since the output file is only marginally smaller than the
> >> >> original.
> >> >
> >> > how did your command line look like? This should work:
> >> >
> >> > osmfilter input_data.osm --keep="landuse=" -o=output_data.osm
> >> >
> >> > If you do NOT want to include nodes and relations on the base of
> their
> >> own landuse tags, enter this:
> >> >
> >> > osmfilter input_data.osm --keep-ways="landuse="
> >> --keep-nodes-relations="" -o=output_data.osm
> >> >
> >> > Markus
More information about the dev
mailing list