Geo::OSM::Primitive - Abstract base classes for the three Open Street Map primitives: node, way and relation.
…
The idea is to encapsulte methods that use OpenStreetMap data (that is possibly stored in Geo::OSM::DBI.
new($osm_id, $primitive_type);
my $type = $osm_primitive->primitive_type(); if ($type eq 'way') { … } elsif ($type eq 'nod') { … } elsif ($type eq 'rel') { … }
Returns the type of the primitive: 'nod' (sic!) if the primitive is a <node>, 'way' if the primitive is a <way> or 'rel' if the primitive is a <relation>.
'nod'
'way'
'rel'
if ($osm_primitive->member_of($rel)) { … }
Tests whether the primitive is a member of the relation $rel. (TODO: currently only checks the cache. If the membership is not found in the cache, it is not further checked for its existence. That should of course be fixed once).
$rel
my $role = $osm_primitive->role($osm_relation);
Returns the role of $osm_relation in <relation> <$osm_relation>. (TODO: currently only works if the role had been set with "_set_cache_role". Of course, the role should also be found if it is not in the cache.).
$osm_relation
<$osm_relation
my $role = 'outer'; $osm_primitive->_set_cache_role($osm_relation, $role);
This method assumes that the primitive on which it is called is a member of $osm_relation (which must be a Geo::OSM::Primitive::Relation) and that the role (which is a string) is $role.
$role
This method is internal and should not be called from a user of Geo::OSM::DBI.
Geo::OSM::DBI
René Nyffenegger
Geo::OSM::Render is a base class to render osm data. Geo::OSM::Render::SVG is a derivation of that base class to render SVG files.
Geo::OSM::DBI can be used to store Open Street Map data in a database. (It should be database independant (hence DBI), yet currently, it probably only works with SQLite.
This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at: http://www.perlfoundation.org/artistic_license_2_0
The source code is on github. Meaningful pull requests are welcome.
To install Geo::OSM::Primitive, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Geo::OSM::Primitive
CPAN shell
perl -MCPAN -e shell install Geo::OSM::Primitive
For more information on module installation, please visit the detailed CPAN module installation guide.