Geo::OSM::MapFeatures - Parses and represents OpenStreetMap Map Features
Version 0.10
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"; } }
Create a new instance of this class. Pass parameters as a hashref.
Parameters:
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.
Downloads Map Features from wiki.openstreetmap.org.
Throws exceptions if something goes wrong.
Returns: undef
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(); }
Parses map features.
Returns a list of feature categories.
Returns a list of features.
If given an argument it as taken as a category, and only features in that category will be returned.
Base exception class for errors thrown by this module
Network error
Go find out who broke map feature this time...
Knut Arne Bjørndal, <bob at cakebox.net>
<bob at cakebox.net>
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.
bug-geo-osm-mapfeatures at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Geo::OSM::MapFeatures
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Geo-OSM-MapFeatures
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Geo-OSM-MapFeatures
CPAN Ratings
http://cpanratings.perl.org/d/Geo-OSM-MapFeatures
Search CPAN
http://search.cpan.org/dist/Geo-OSM-MapFeatures
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:
Non-ASCII character seen before =encoding in 'Bjørndal,'. Assuming UTF-8
To install Geo::OSM::MapFeatures, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Geo::OSM::MapFeatures
CPAN shell
perl -MCPAN -e shell install Geo::OSM::MapFeatures
For more information on module installation, please visit the detailed CPAN module installation guide.