The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Geo::Parse::OSM - OpenStreetMap file parser

VERSION

Version 0.10

SYNOPSIS

    use Geo::Parse::OSM;

    my $osm = Geo::Parse::OSM->new( 'planet.osm' );
    $osm->seek_to_relations;
    $osm->parse( sub{ warn $_[0]->{id}  if  $_[0]->{user} eq 'Alice' } );

METHODS

new

Creates parser instance and opens file

    my $osm = Geo::Parse::OSM->new( 'planet.osm' );

parse

Parses file and executes callback function for every object. Stops parsing if callback returns 'stop'

    $osm->parse( sub{ warn $_[0]->{id} and return 'stop' } );

It's possible to filter out unnecessary object types

    $osm->parse( sub{ ... }, only => 'way' );

seek_to_nodes =head2 seek_to_ways =head2 seek_to_relations

Seeks to the start of objects of selected type

    $osm->seek_to_ways;

FUNCTIONS

parse_file

Simple parser - parses contents of file and executes callback function for every object.

    Geo::Parse::OSM->parse_file( 'planet.osm', sub{ print Dumper $_[0] } );

AUTHOR

liosha, <liosha at cpan.org>

BUGS

Please report any bugs or feature requests to bug-geo-parse-osm at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Geo-Parse-OSM. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Geo::Parse::OSM

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2010 liosha.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.