This file is indexed.

/usr/bin/convert2osm is in foxtrotgps 1.2.0-1build1.

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

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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
#!/usr/bin/perl
#
# (c) 2008 Marcus Bauer
# License: GPLv2
#
# Convert tangoGPS .csv logfiles into .osm files for processing in JOSM
#
# Usage: ./convert2osm.pl logfiles*.log
#
# creates for each input .log one .osm file
#




$curr_arg = "";

while(<>)
{

	if($curr_arg ne $ARGV)
	{
		if($curr_arg ne "")
		{
			&print_footer;
			close(FD);

			&convert2osm;

		}
		$curr_arg = $ARGV;

		$filename = $ARGV . ".gpx";
		print $filename . "\n";
		open(FD, "> $filename");
		&print_header;
	}

	else
	{
		&print_trackpoint;
	}
	
}


#--------------------------------
# and the same for the last file:
#--------------------------------
&print_footer;
&convert2osm;


### END MAIN


#########################################################
#
# sub routines
#
#########################################################


#---------
# header
#---------

sub print_header
{
print FD <<EOT
<?xml version="1.0" encoding="UTF-8"?>
<gpx	version="1.0"
	creator="convert2gpx.pl http://www.tangogps.org"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://www.topografix.com/GPX/1/0"
	xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">

<trk>
<trkseg>

EOT
;
}


#-------------
# trackpoint
# ------------

sub print_trackpoint
{
@arr = split(',',$_);
chop @arr[6];


print FD <<EOT
<trkpt lat="@arr[0]" lon="@arr[1]">
  <ele>@arr[2]</ele>
  <speed>@arr[3]</speed>
  <course>@arr[4]</course>
  <fix>3d</fix>
  <hdop>@arr[5]</hdop>
  <time>@arr[6]</time>
</trkpt>

EOT
;
}


#---------
# footer
# --------

sub print_footer
{

print FD <<EOT

</trkseg>
</trk>
</gpx>

EOT
;

}


#=======================================================================
#
# convert 2 osm
#
#=======================================================================


#---------------------------------------------------------------------
#
# MAIN SUB convert to .osm
#
#----------------------------------------------------------------------
sub convert2osm
{

	#
	# 1. simplify with gpsbabel
	#
	`gpsbabel -i gpx -f $filename -x simplify,error=0.001k -x discard,hdop=3.1 -o csv -F $filename.csv`;


	#
	# 2. convert .csv to .osm
	#
	&convert_csv2osm;


	#
	# 3. remove .csv
	#
	`rm $filename.csv`;

}

# END MAIN SUB convert2osm




#----------------
# .csv to .osm
#----------------

sub convert_csv2osm
{

	print "converting to osm...\n";

	$i = 0;

	open(FDCSV,"$filename.csv") || die $filename.csv;
	open(FDOSM,"> $filename.osm") || die $filename.osm;

	&print_header_osm;

	while($_ = <FDCSV>)
	{
		&print_nodes_osm;
	}
	
	&print_way_osm;

	&print_footer_osm;

	close FDCSV;
	close FDOSM;

}


#----------
# header
#----------

sub print_header_osm
{
print FDOSM "<?xml version='1.0' encoding='UTF-8'?>\n";
print FDOSM "<osm version='0.5' generator='JOSM'>\n";
}



#---------
# nodes
#---------

sub print_nodes_osm
{
	$i--;

	@arr = split(',', $_);
	$lat = $arr[0];
	$lon = $arr[1];
	$lon =~ s/ //;
	print FDOSM "\t<node id='$i' visible='true' lat='$lat' lon='$lon' />\n";
}


#-------
# way
#-------

sub print_way_osm
{
	$way_id = $i - 1;

	print FDOSM "\t<way id='$way_id' action='modify' visible='true'>\n";

	$j = -1;
	for(; $i<0; $i++)
	{
		print FDOSM "\t\t<nd ref='$j' />\n";
		$j--;
	}

}


#----------
# footer
#----------

sub print_footer_osm
{
	print FDOSM "\t\t<tag k='highway' v='residential' /> \n";
	print FDOSM "\t\t<tag k='name' v='nn' /> \n";

	print FDOSM "\t</way> \n";
	print FDOSM "</osm> \n";
}