The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Geo::OSM::MapFeatures - Parses and represents OpenStreetMap Map Features

VERSION

Version 0.10

SYNOPSIS

 use Geo::OSM::MapFeatures;
 
 my $mf = new Geo::OSM::MapFeatures;
 $mf->download();
 $mf->parse();
 
 # To print a simple ascii representation:
 foreach my $category ( sort( $mf->categories() ) ){
     print "\n\n===== $category =====\n";
     foreach my $feature ( $mf->features($category) ){
         print "$feature\n";
     }
 }
 
 # Or you can choose not to use the string overloading and get the
 # individual elements yourself:
 foreach my $category ( sort( $mf->categories() ) ){
     print "\n\n===== $category =====\n";
     foreach my $feature ( $mf->features($category) ){
         print "Key: ".$feature->key()."\n";
         print "Value(s): ". join("\n          ", @{$feature->values()})."\n";
         print "Description: ".$feature->description()."\n\n";
     }
 }

FUNCTIONS

new (constructor)

Create a new instance of this class. Pass parameters as a hashref.

Parameters:

page

What page to fetch. Defaults to "Map_Features".

Translated pages work if the table header names are recognized, the module contains a mapping table with translated names in over a dozen languages.

Returns: new instance of this class.

download

Downloads Map Features from wiki.openstreetmap.org.

Throws exceptions if something goes wrong.

Returns: undef

debug_download

Download and cache in "mapfeatures.debug" in the current directory, to avoid downloading the page again and again when developing.

For example do something like the following:

 unless( $ENV{MAPFEATURESDEBUG} ){
        $mf->download();
 } else {
        $mf->debug_download();
 }

parse

Parses map features.

categories

Returns a list of feature categories.

features

Returns a list of features.

If given an argument it as taken as a category, and only features in that category will be returned.

Exception classes

Geo::OSM::MapFeatures::Error

Base exception class for errors thrown by this module

Geo::OSM::MapFeatures::Error::Network

Network error

Geo::OSM::MapFeatures::Error::Parse

Go find out who broke map feature this time...

AUTHOR

Knut Arne Bjørndal, <bob at cakebox.net>

BUGS

Categories are currently made by concatenating headings above a feature. This should probably be a proper hierarchy instead.

The table header translation table should probably be easier to patch from programs calling the module. Or maybe even downloaded from the wiki or something.

Please report any bugs or feature requests to bug-geo-osm-mapfeatures at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Geo-OSM-MapFeatures. 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::OSM::MapFeatures

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2008-2009 Knut Arne Bjørndal, all rights reserved.

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

1 POD Error

The following errors were encountered while parsing the POD:

Around line 455:

Non-ASCII character seen before =encoding in 'Bjørndal,'. Assuming UTF-8