23 Oct 2014

Anonymize Windows-Phone-8 OSM-Logger GPS Traces Using a Perl Script

“Anonymize” and remove way-points (only keep ordered track points) from Windows-Phone-8 OSM-Logger .gpx GPS traces using a Perl script:

#!/usr/bin/perl
use strict;
use warnings;
use 5.010;
use File::Slurp;

die "Usage: $0 [FILENAME.gpx]\n" if @ARGV < 1;
my $text = read_file($ARGV[0]);
$text =~ s/<name>.*?<\/name>/<name>name<\/name>/g;
$text =~ s/<desc>.*?<\/desc>/<desc>desc<\/desc>/g;
$text =~ s/<email .*? \/>/<email id="none" domain="test.com" \/>/g;
$text =~ s/<time>.*?<\/time>/<time>2000-01-01T00:00:00Z<\/time>/g;
$text =~ s/<wpt.*<\/wpt>//sg;
write_file( $ARGV[0], $text );