GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Geo::Parse::OSM(3) User Contributed Perl Documentation Geo::Parse::OSM(3)

Geo::Parse::OSM - OpenStreetMap XML file regexp parser

version 0.42

    use Geo::Parse::OSM;

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

Creates parser instance and opens file

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

Compressed files (.gz, .bz2) are also supported.

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' );
    $osm->parse( sub{ ... }, only => [ 'way', 'relation' ] );

Seeks to the file position or to the first object of selected type.

    $osm->seek_to( 0 );
    $osm->seek_to( 'way' );

Can be slow on compressed files!

    $osm->seek_to_ways;     # same as seek_to('way');

Class method - creates parser instance and does one parser() pass. Returns created parser object.

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

Returns xml representation of the callback object.

    sub callback {
        print Geo::Parse::OSM::object_to_xml( shift @_);
    }
    Geo::Parse::OSM->parse_file( 'planet.osm', \&callback );

liosha, "<liosha at cpan.org>"

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.

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

    perldoc Geo::Parse::OSM

You can also look for information at:

  • RT: CPAN's request tracker

    <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Geo-Parse-OSM>

  • AnnoCPAN: Annotated CPAN documentation

    <http://annocpan.org/dist/Geo-Parse-OSM>

  • CPAN Ratings

    <http://cpanratings.perl.org/d/Geo-Parse-OSM>

  • Search CPAN

    <http://search.cpan.org/dist/Geo-Parse-OSM/>

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.

2011-02-19 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.