Subject: | How about adding waypoints one at a time? |
I have a particular use that builds up tracks over time, so I'd like to be able to add waypoints
to the Geo::Gpx object I already have. I'm not picky, but here's is what I hacked up. I'd really
like a Geo::Gpx::Waypoint object, but I haven't got that far. :)
sub Geo::Gpx::add_waypoint
{
unless( eval { keys %{$_[1]} } )
{
carp "waypoint argument must be a hash reference";
return;
}
unless( exists $_[1]{lon} and exists $_[1]{lat} )
{
carp "'lat' and 'lon' keys are mandatory in waypoint hash";
return;
}
push @{ $_[0]->{waypoints} }, $_[1];
}