libosm-gary68-perl/0000775000175000017500000000000011641417615013371 5ustar daviddavidlibosm-gary68-perl/lib/0000775000175000017500000000000011641417615014137 5ustar daviddavidlibosm-gary68-perl/lib/OSM/0000775000175000017500000000000011641417615014575 5ustar daviddavidlibosm-gary68-perl/lib/OSM/gpx.pm0000775000175000017500000001016311641417615015735 0ustar daviddavid# # 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 # 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 / ; 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>/ ) ; my ($name) = ( $line =~ /(.+?)<\/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 //i, $line) { $line = getLine() ; } } my ($name) = ( $line =~ /(.+?)<\/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 //i, $line) { if ( grep //i, $line) { $line = getLine() ; } } $line = getLine() ; } # print " track segment finished\n" ; } my ($name) = ( $line =~ /(.+?)<\/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/\//i ; return $name ; } 1 ; libosm-gary68-perl/lib/OSM/osm.pm0000775000175000017500000013032711641417615015742 0ustar daviddavid# # # PERL osm module by gary68 # # !!! store as osm.pm in folder OSM in lib directory !!! # # This module contains a lot of useful functions for working with osm files and data. it also # includes functions for calculation and output. # # # Copyright (C) 2008, 2009, 2010 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 # # # version 2 # - added html table functions # # Version 3 # - added project and angle # - added support for bz2 files # # Version 4 # - add support for relations # - select multiple ways in JOSM link # - getNode2, getWay2: return tags as arrays # # Version 4.1 # - getBugs added # # Version 4.2 # - map compare link added # # Version 4.3 # - regex for k/v changed # # Version 4.4 # -added relation analyzer link # # Version 4.41 (gary68) # - changed regex for openosmfile from /node/ to /