This file is indexed.

/usr/share/perl5/OSM/gpx.pm is in libosm-gary68-perl 0.0~svn26727-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# 
# PERL mapweaver module by gary68
#
#
#
#
# Copyright (C) 2011, Gerhard Schwanz
#
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the 
# Free Software Foundation; either version 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>
#


package OSM::gpx ; 

use strict ;
use warnings ;

use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);

require Exporter ;

@ISA = qw ( Exporter AutoLoader ) ;

@EXPORT = qw (	readGPXFile
		 ) ;

my $file ;
my $line ;

my $wptNr = 0 ;
my $trkNr = 0 ;
my $rteNr = 0 ;
my %wpt = () ;
my %trk = () ;
my %rte = () ;




sub readGPXFile {
	my $name = shift ;

	my $res = open ($file, "<", $name) ;

	if ($res) {

		$line = getLine() ;
		while (defined $line) {

			if ( grep /<wpt/i, $line) { readWpt() ; }
			if ( grep /<rte/i, $line) { readRte() ; }
			if ( grep /<trk/i, $line) { readTrk() ; }

			$line = getLine() ;
		}

		close ($file) ;

	}
	else {
		print "ERROR: can't open gpx file $name\n" ;
	}

	print "gpx file $name read. $wptNr waypoint(s), $trkNr track(s) and $rteNr route(s).\n" ;

	return (\%wpt, \%rte, \%trk) ;
}



sub getLine {
	$line = <$file> ;
	if (defined $line) {	
		$line =~ s/\r//g ; # remove dos/win char at line end
	}

	if (defined $line) {
		$line =~ s/^\s// ;
		$line =~ s/\s$// ;
	}

	while ( (defined $line) and  (length $line == 0) ) {
		$line = <$file> ;
	}
	return $line ;
}


sub readWpt {
	$wptNr++ ;
	# print "read wpt $wptNr\n" ;
	my ($lon) = ( $line =~ /lon=\"(.+?)\"/ ) ;
	my ($lat) = ( $line =~ /lat=\"(.+?)\"/ ) ;

	$wpt{$wptNr}{"lon"} = $lon ;
	$wpt{$wptNr}{"lat"} = $lat ;

	while ( ! grep /<\/wpt>/i, $line) {
		my ($ele) = ( $line =~ /<ele>(.+?)<\/ele>/ ) ;
		my ($name) = ( $line =~ /<name>(.+?)<\/name>/ ) ;
		if (defined $name) { $wpt{$wptNr}{"name"} = cleanName ($name) ; } 
		if (defined $ele) { $wpt{$wptNr}{"ele"} = $ele ; } 
		$line = getLine() ;
	}
}


sub readRte {
	$rteNr++ ;
	# print "read route $rteNr\n" ;
	my $rteWptNr = 0 ;

	$line = getLine() ;
	while ( ! grep /<\/rte>/i, $line) {

		if ( grep /<rtept/i, $line) { 
			$rteWptNr++ ;
			my ($lon) = ( $line =~ /lon=\"(.+?)\"/ ) ;
			my ($lat) = ( $line =~ /lat=\"(.+?)\"/ ) ;
			$rte{$rteNr}{$rteWptNr}{"lon"} = $lon ;
			$rte{$rteNr}{$rteWptNr}{"lat"} = $lat ;

			while ( ! grep /<\/rtept>/i, $line) {
				$line = getLine() ;
			}
		}

		my ($name) = ( $line =~ /<name>(.+?)<\/name>/ ) ;
		# if (defined $name) { $rte{$rteNr}{"name"} = cleanName ($name) ; } 

		$line = getLine() ;
	}
}



sub readTrk {
	$trkNr++ ;
	my $trkSegNr = 0 ;
	# print "read track $trkNr\n" ;

	$line = getLine() ;
	while ( ! grep /<\/trk>/i, $line) {

		if ( grep /<trkseg/i, $line) { 
			$trkSegNr++ ;
			# print "  read track segment $trkSegNr\n" ;
			my $wptNr = 0 ;

			while ( ! grep /<\/trkseg>/i, $line) {

				if ( grep /<trkpt/i, $line) {
					$wptNr++ ;					
					# print "    read track wpt $wptNr\n" ;
					my ($lon) = ( $line =~ /lon=\"(.+?)\"/ ) ;
					my ($lat) = ( $line =~ /lat=\"(.+?)\"/ ) ;
					$trk{$trkNr}{$trkSegNr}{$wptNr}{"lon"} = $lon ;
					$trk{$trkNr}{$trkSegNr}{$wptNr}{"lat"} = $lat ;

					while ( ! grep /<\/trkpt>/i, $line) {
						$line = getLine() ;
					}
				}

				$line = getLine() ;

			}

			# print "  track segment finished\n" ;
		}

		my ($name) = ( $line =~ /<name>(.+?)<\/name>/ ) ;
		# if (defined $name) { $trk{$trkNr}{"name"} = cleanName ($name) ; } 

		$line = getLine() ;
		# print "  track finished\n" ;
	}
	# print "readTrK finished\n" ;
}



sub cleanName {
	my $name = shift ;
	$name =~ s/\<!\[CDATA\[//i ; 
	$name =~ s/\]\]>//i ; 
	return $name ;
}


1 ;