in reply to how to access GPX data
use List::Util qw[sum]; foreach my $track (@$tracks) { my @points = map { @{$_->{points}} } @{ $track->{segments} }; my $count_of_points = @points; my $total_elevation = sum 0, map { $_->{ele} } @points; my $average = $total_elevation / $count_of_points; printf "%s = %d\n", $track->{name}, $average; }
Though I get 69 for the average elevation of Track 1. You seem to be ignoring the fourth measurement (63.0). My code above does not ignore that.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to access GPX data
by geogpx (Initiate) on May 27, 2012 at 13:45 UTC |