NAME

OSM::Filter -- Filter OpenStreetMap Data

SYNOPSIS

 #!/usr/bin/perl
 use strict;
 use warnings;
 use OSM::Filter;

 my $filter=OSM::Filter->new(infile=>'test.osm', outfile=>'result.osm');
 $filter->filter_add('way', sub{ my $way=shift; return 1 if($way->has_tag('highway')); return 0});
 $filter->run();

 # or

 my $filter=OSM::Filter->new(infile=>'test.osm');
 $filter->filter_add('way', sub{ my $way=shift; return 1 if($way->has_tag('highway')); return 0});
 my $osm=$filter->run(); # <= returns an OSM::Tree

DESCRIPTION

Filter OpenStreetMap XML file

AUTHOR

ToPeG

METHODS

new( (optionname => option)+ )

create a new Filter-Object

returns an OSM::Filter Object

Options:

- infile

an input file

- outfile

the output file

- fh

an input filehandle

- data

an OSM-XML String

- filter

an array of filter:

filter:

 ['<key>',sub{<code>},<options>]

key = [node, way, relation]

file_out(<Filename>)

get/set output file

file_in(<Filename>)

set input file

filter_add(<Key>, <Code>, <Options>)

add an filter

run()

run filter

return OSM::Tree if no outputfile is set else return 1 on success

AUTHOR

Tobias Grönhagen <osm@topeg.de>

VERSION

Version 0.1 11 Apr 2011

COPYRIGHT

Copyright (c) Tobias Grönhagen. All rights reserved.

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms and conditions as Perl itself.

This means that you can, at your option, redistribute it and/or modify it under either the terms the GNU Public License (GPL) version 2 or later, or under the Perl Artistic License.

See http://dev.perl.org/licenses/

DISCLAIMER

THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

Use of this software in any way or in any form, source or binary, is not allowed in any country which prohibits disclaimers of any implied warranties of merchantability or fitness for a particular purpose or any disclaimers of a similar nature.

IN NO EVENT SHALL I BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION (INCLUDING, BUT NOT LIMITED TO, LOST PROFITS) EVEN IF I HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE