2010-04-28 Sancho Lerena <slerena@artica.es>
* util/gpx2pandora_agent_data.pl: Added support to process gpx files with tracks, plus the RTE format. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2628 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
f1c9ccb1b4
commit
a2abf97eb2
|
@ -1,5 +1,8 @@
|
||||||
2010-04-28 Sancho Lerena <slerena@artica.es>
|
2010-04-28 Sancho Lerena <slerena@artica.es>
|
||||||
|
|
||||||
|
* util/gpx2pandora_agent_data.pl: Added support to process
|
||||||
|
gpx files with tracks, plus the RTE format.
|
||||||
|
|
||||||
* lib/PandoraFMS/Core.pm: Fixed call to group stats and now
|
* lib/PandoraFMS/Core.pm: Fixed call to group stats and now
|
||||||
process all groups (included disabled) and group 1, because
|
process all groups (included disabled) and group 1, because
|
||||||
with 3.1 group id 1 is not "all" anymore.
|
with 3.1 group id 1 is not "all" anymore.
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
# (c) Artica ST 2010, for Pandora FMS monitoring system
|
||||||
|
# See more at http://pandorafms.org
|
||||||
|
# Licensed under GPL2 license.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
|
@ -16,6 +20,8 @@ use constant AGENT_VERSION => '3.1';
|
||||||
|
|
||||||
if ($#ARGV != 1) {
|
if ($#ARGV != 1) {
|
||||||
print "Pandora FMS GIS tool to produce XML files from a standard GPX file\n";
|
print "Pandora FMS GIS tool to produce XML files from a standard GPX file\n";
|
||||||
|
print "This tool will not work with waypoints. To convert Waypoints to Tracks\n";
|
||||||
|
print "please use another software like GPSBabel \n";
|
||||||
print "This will put all the XML files in /var/spool/pandora/data_in directory \n";
|
print "This will put all the XML files in /var/spool/pandora/data_in directory \n";
|
||||||
print "\n";
|
print "\n";
|
||||||
print "Usage: $0 <filename.gpx> <agent_name>\n\n";
|
print "Usage: $0 <filename.gpx> <agent_name>\n\n";
|
||||||
|
@ -50,30 +56,37 @@ if ($@) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Debug, code commented
|
# Debug, code commented
|
||||||
print "Printing XML DATA\n";
|
# print "Printing XML DATA\n";
|
||||||
#print Dumper ($xml_data);
|
#print Dumper ($xml_data);
|
||||||
#print "Finish Printing XML DATA\n";
|
#print "Finish Printing XML DATA\n";
|
||||||
# 'rte' => [
|
|
||||||
# {
|
# Detect if Rte or Track format
|
||||||
# 'rtept' => [
|
|
||||||
# {
|
my $gpx_format = "";
|
||||||
# 'ele' => [
|
|
||||||
# '728'
|
if (defined($xml_data->{'rte'}[0])){
|
||||||
# ],
|
$gpx_format = "RTE";
|
||||||
# 'speed' => [
|
} else {
|
||||||
# '0'
|
$gpx_format = "TRK";
|
||||||
# ],
|
}
|
||||||
# 'time' => [
|
|
||||||
# '2010-02-19T10:45:08Z'
|
print "Detecting GPX in $gpx_format format \n";
|
||||||
# ],
|
|
||||||
# 'lat' => '40.4327545166',
|
my $posiciones;
|
||||||
# 'lon' => '-3.7009150982'
|
my $track_segment;
|
||||||
# },
|
my $foreach_pointer;
|
||||||
#
|
|
||||||
my $posiciones = $xml_data->{'rte'}[0];
|
if ($gpx_format eq "RTE"){
|
||||||
|
$posiciones = $xml_data->{'rte'}[0];
|
||||||
|
$foreach_pointer = $posiciones->{'rtept'}
|
||||||
|
} else {
|
||||||
|
$posiciones = $xml_data->{'trk'}[0];
|
||||||
|
$track_segment = $posiciones->{"trkseg"}[0];
|
||||||
|
$foreach_pointer = $track_segment->{'trkpt'}
|
||||||
|
}
|
||||||
|
|
||||||
# Process positions
|
# Process positions
|
||||||
foreach my $position (@{$posiciones->{'rtept'}}) {
|
foreach my $position (@{$foreach_pointer}) {
|
||||||
my $longitude= $position->{'lon'};
|
my $longitude= $position->{'lon'};
|
||||||
my $latitude= $position->{'lat'};
|
my $latitude= $position->{'lat'};
|
||||||
my $altitude= $position->{'ele'}[0];
|
my $altitude= $position->{'ele'}[0];
|
||||||
|
|
Loading…
Reference in New Issue