summaryrefslogtreecommitdiff
path: root/navit/script/osm/Geo
diff options
context:
space:
mode:
authorJoseph Herlant <herlantj@gmail.com>2018-05-25 22:07:07 -0700
committerJoseph Herlant <aerostitch@users.noreply.github.com>2018-05-25 22:17:50 -0700
commit41a1264cdd43a11695de85eab0bd3c941abf2b70 (patch)
tree3da1ef3bebc674807258ae824ff9156a64adf370 /navit/script/osm/Geo
parent8a76acb966f7059caf9d72c853175bd923b1e9d7 (diff)
downloadnavit-41a1264cdd43a11695de85eab0bd3c941abf2b70.tar.gz
cleanup:cmake:remove trailing spaces
Diffstat (limited to 'navit/script/osm/Geo')
-rw-r--r--navit/script/osm/Geo/OSM/APIClientV4.pm46
-rw-r--r--navit/script/osm/Geo/OSM/APIClientV5.pm58
-rw-r--r--navit/script/osm/Geo/OSM/APIClientV6.pm64
-rw-r--r--navit/script/osm/Geo/OSM/EntitiesV3.pm32
-rw-r--r--navit/script/osm/Geo/OSM/EntitiesV5.pm38
-rw-r--r--navit/script/osm/Geo/OSM/EntitiesV6.pm38
-rw-r--r--navit/script/osm/Geo/OSM/MapFeatures.pm10
-rw-r--r--navit/script/osm/Geo/OSM/OsmChangeReaderV3.pm18
-rw-r--r--navit/script/osm/Geo/OSM/OsmChangeReaderV5.pm16
-rw-r--r--navit/script/osm/Geo/OSM/OsmChangeReaderV6.pm16
-rw-r--r--navit/script/osm/Geo/OSM/OsmReaderV3.pm14
-rw-r--r--navit/script/osm/Geo/OSM/OsmReaderV5.pm14
-rw-r--r--navit/script/osm/Geo/OSM/OsmReaderV6.pm14
-rw-r--r--navit/script/osm/Geo/OSM/OsmXML.pm12
-rw-r--r--navit/script/osm/Geo/OSM/Planet.pm30
-rw-r--r--navit/script/osm/Geo/OSM/SegmentList.pm42
-rw-r--r--navit/script/osm/Geo/OSM/Tracks2OSM.pm4
-rw-r--r--navit/script/osm/Geo/OSM/Upload.pm32
-rw-r--r--navit/script/osm/Geo/OSM/Write.pm16
19 files changed, 257 insertions, 257 deletions
diff --git a/navit/script/osm/Geo/OSM/APIClientV4.pm b/navit/script/osm/Geo/OSM/APIClientV4.pm
index 26b8ec5fc..d5a267e1c 100644
--- a/navit/script/osm/Geo/OSM/APIClientV4.pm
+++ b/navit/script/osm/Geo/OSM/APIClientV4.pm
@@ -22,10 +22,10 @@ use POSIX qw(sigprocmask);
sub new
{
my( $class, %attr ) = @_;
-
+
my $obj = bless {}, $class;
- my $url = $attr{api};
+ my $url = $attr{api};
if( not defined $url )
{
croak "Did not specify aip url";
@@ -34,7 +34,7 @@ sub new
$url =~ s,/$,,; # Strip trailing slash
$obj->{url} = $url;
$obj->{client} = new LWP::UserAgent(agent => 'Geo::OSM::APIClientV4', timeout => 1200);
-
+
if( defined $attr{username} and defined $attr{password} )
{
if( $obj->{url} =~ m,http://([\w.]+)/, )
@@ -44,7 +44,7 @@ sub new
my $encoded = MIME::Base64::encode_base64("$attr{username}:$attr{password}","");
$obj->{client}->default_header( "Authorization", "Basic $encoded" );
}
-
+
$obj->{reader} = init Geo::OSM::OsmReader( sub { _process($obj,@_) } );
return $obj;
}
@@ -62,7 +62,7 @@ sub _process
if( ref $obj->{buffer} eq "CODE" )
{ $obj->{buffer}->($ent); return }
die "Internal error: don't know what to do with buffer $obj->{buffer}";
-}
+}
# Utility function to handle the temporary blocking of signals in a way that
# works with exception handling.
@@ -104,18 +104,18 @@ sub create
$ent->set_id($oldid);
my $req = new HTTP::Request PUT => $self->{url}."/".$ent->type()."/create";
$req->content($content);
-
+
# print $req->as_string;
-
+
my $res = $self->_request($req);
-
+
# print $res->as_string;
if( $res->code == 200 )
{
return $res->content
}
-
+
$self->{last_error} = $res;
return undef;
}
@@ -126,11 +126,11 @@ sub modify
my $content = encode("utf-8", $ent->full_xml);
my $req = new HTTP::Request PUT => $self->{url}."/".$ent->type()."/".$ent->id();
$req->content($content);
-
+
# print $req->as_string;
-
+
my $res = $self->_request($req);
-
+
return $ent->id() if $res->code == 200;
$self->{last_error} = $res;
return undef;
@@ -142,11 +142,11 @@ sub delete
my $content = encode("utf-8", $ent->full_xml);
my $req = new HTTP::Request DELETE => $self->{url}."/".$ent->type()."/".$ent->id();
# $req->content($content);
-
+
# print $req->as_string;
-
+
my $res = $self->_request($req);
-
+
return $ent->id() if $res->code == 200;
$self->{last_error} = $res;
return undef;
@@ -157,9 +157,9 @@ sub get($$)
my $self = shift;
my $type = shift;
my $id = shift;
-
+
my $req = new HTTP::Request GET => $self->{url}."/$type/$id";
-
+
my $res = $self->_request($req);
if( $res->code != 200 )
@@ -167,7 +167,7 @@ sub get($$)
$self->{last_error} = $res;
return undef;
}
-
+
my @res;
$self->{buffer} = \@res;
$self->{reader}->parse($res->content);
@@ -176,7 +176,7 @@ sub get($$)
{
die "Unexpected response for get_$type [".$res->content()."]\n";
}
-
+
return $res[0];
}
@@ -203,9 +203,9 @@ sub map($$$$)
{
my $self = shift;
my @bbox = @_;
-
+
my $req = new HTTP::Request GET => $self->{url}."/map?bbox=$bbox[0],$bbox[1],$bbox[2],$bbox[3]";
-
+
my $res = $self->_request($req);
if( $res->code != 200 )
@@ -213,12 +213,12 @@ sub map($$$$)
$self->{last_error} = $res;
return undef;
}
-
+
my @res;
$self->{buffer} = \@res;
$self->{reader}->parse($res->content);
undef $self->{buffer};
-
+
return \@res;
}
diff --git a/navit/script/osm/Geo/OSM/APIClientV5.pm b/navit/script/osm/Geo/OSM/APIClientV5.pm
index 5bee097de..39cc124d9 100644
--- a/navit/script/osm/Geo/OSM/APIClientV5.pm
+++ b/navit/script/osm/Geo/OSM/APIClientV5.pm
@@ -24,10 +24,10 @@ use Socket qw(inet_ntoa);
sub new
{
my( $class, %attr ) = @_;
-
+
my $obj = bless {}, $class;
- my $url = $attr{api};
+ my $url = $attr{api};
if( not defined $url )
{
croak "Did not specify api url";
@@ -36,13 +36,13 @@ sub new
$url =~ s,/$,,; # Strip trailing slash
$obj->{url} = URI->new($url);
$obj->{client} = new LWP::UserAgent(agent => 'Geo::OSM::APIClientV5', timeout => 1200);
-
+
if( defined $attr{username} and defined $attr{password} )
{
my $encoded = MIME::Base64::encode_base64("$attr{username}:$attr{password}","");
$obj->{client}->default_header( "Authorization", "Basic $encoded" );
}
-
+
# We had the problem of the client doing a DNS lookup each request. To
# solve this we do a gethostbyname now and store that in the URI.
{
@@ -57,7 +57,7 @@ sub new
}
# Hack to avoid protocol lookups each time
@LWP::Protocol::http::EXTRA_SOCK_OPTS = ( 'Proto' => 6 );
-
+
$obj->{reader} = init Geo::OSM::OsmReader( sub { _process($obj,@_) } );
return $obj;
}
@@ -75,7 +75,7 @@ sub _process
if( ref $obj->{buffer} eq "CODE" )
{ $obj->{buffer}->($ent); return }
die "Internal error: don't know what to do with buffer $obj->{buffer}";
-}
+}
# Utility function to handle the temporary blocking of signals in a way that
# works with exception handling.
@@ -121,18 +121,18 @@ sub create($)
$ent->set_id($oldid);
my $req = new HTTP::Request PUT => $self->{url}."/".$ent->type()."/create";
$req->content($content);
-
+
# print $req->as_string;
-
+
my $res = $self->_request($req);
-
+
# print $res->as_string;
if( $res->code == 200 )
{
return $res->content
}
-
+
$self->{last_error} = $res;
return undef;
}
@@ -143,11 +143,11 @@ sub modify($)
my $content = encode("utf-8", $ent->full_xml);
my $req = new HTTP::Request PUT => $self->{url}."/".$ent->type()."/".$ent->id();
$req->content($content);
-
+
# print $req->as_string;
-
+
my $res = $self->_request($req);
-
+
return $ent->id() if $res->code == 200;
$self->{last_error} = $res;
return undef;
@@ -159,11 +159,11 @@ sub delete($)
my $content = encode("utf-8", $ent->full_xml);
my $req = new HTTP::Request DELETE => $self->{url}."/".$ent->type()."/".$ent->id();
# $req->content($content);
-
+
# print $req->as_string;
-
+
my $res = $self->_request($req);
-
+
return $ent->id() if $res->code == 200;
$self->{last_error} = $res;
return undef;
@@ -175,12 +175,12 @@ sub get($$)
my $type = shift;
my $id = shift;
my $extra = shift;
-
+
$extra = "/".$extra if (defined $extra);
$extra = "" if not defined $extra;
my $req = new HTTP::Request GET => $self->{url}."/$type/$id$extra";
-
+
my $res = $self->_request($req);
if( $res->code != 200 )
@@ -188,7 +188,7 @@ sub get($$)
$self->{last_error} = $res;
return undef;
}
-
+
my @res;
$self->{buffer} = \@res;
$self->{reader}->parse($res->content);
@@ -215,7 +215,7 @@ sub resurrect($$)
if (defined $ret || !defined $self->{last_error} || ($self->{last_error}->code != 410)) {
return $ret;
}
-
+
my @ents = $self->get($type, $id, 'history');
# we want the last _visible_ one
my $ent = $ents[-2];
@@ -270,9 +270,9 @@ sub get_subtype($$)
my $type = shift;
my $id = shift;
my $subtype = shift;
-
+
my $req = new HTTP::Request GET => $self->{url}."/$type/$id/$subtype";
-
+
my $res = $self->_request($req);
if( $res->code != 200 )
@@ -280,7 +280,7 @@ sub get_subtype($$)
$self->{last_error} = $res;
return undef;
}
-
+
my @res;
$self->{buffer} = \@res;
$self->{reader}->parse($res->content);
@@ -289,7 +289,7 @@ sub get_subtype($$)
{
die "Unexpected response for get_subtype($type,$id,$subtype) [".$res->content()."]\n";
}
-
+
return \@res;
}
@@ -297,7 +297,7 @@ sub get_node_ways($)
{
my $self = shift;
my $id = shift;
-
+
return $self->get_subtype("node",$id,"ways");
}
@@ -305,9 +305,9 @@ sub map($$$$)
{
my $self = shift;
my @bbox = @_;
-
+
my $req = new HTTP::Request GET => $self->{url}."/map?bbox=$bbox[0],$bbox[1],$bbox[2],$bbox[3]";
-
+
my $res = $self->_request($req);
if( $res->code != 200 )
@@ -315,12 +315,12 @@ sub map($$$$)
$self->{last_error} = $res;
return undef;
}
-
+
my @res;
$self->{buffer} = \@res;
$self->{reader}->parse($res->content);
undef $self->{buffer};
-
+
return \@res;
}
diff --git a/navit/script/osm/Geo/OSM/APIClientV6.pm b/navit/script/osm/Geo/OSM/APIClientV6.pm
index d659ac14c..304564be5 100644
--- a/navit/script/osm/Geo/OSM/APIClientV6.pm
+++ b/navit/script/osm/Geo/OSM/APIClientV6.pm
@@ -24,10 +24,10 @@ use Socket qw(inet_ntoa);
sub new
{
my( $class, %attr ) = @_;
-
+
my $obj = bless {}, $class;
- my $url = $attr{api};
+ my $url = $attr{api};
if( not defined $url )
{
croak "Did not specify api url";
@@ -36,13 +36,13 @@ sub new
$url =~ s,/$,,; # Strip trailing slash
$obj->{url} = URI->new($url);
$obj->{client} = new LWP::UserAgent(agent => 'Geo::OSM::APIClientV6', timeout => 1200);
-
+
if( defined $attr{username} and defined $attr{password} )
{
my $encoded = MIME::Base64::encode_base64("$attr{username}:$attr{password}","");
$obj->{client}->default_header( "Authorization", "Basic $encoded" );
}
-
+
# We had the problem of the client doing a DNS lookup each request. To
# solve this we do a gethostbyname now and store that in the URI.
{
@@ -57,7 +57,7 @@ sub new
}
# Hack to avoid protocol lookups each time
@LWP::Protocol::http::EXTRA_SOCK_OPTS = ( 'Proto' => 6 );
-
+
$obj->{reader} = init Geo::OSM::OsmReader( sub { _process($obj,@_) } );
return $obj;
}
@@ -75,7 +75,7 @@ sub _process
if( ref $obj->{buffer} eq "CODE" )
{ $obj->{buffer}->($ent); return }
die "Internal error: don't know what to do with buffer $obj->{buffer}";
-}
+}
# Utility function to handle the temporary blocking of signals in a way that
# works with exception handling.
@@ -125,11 +125,11 @@ sub create_changeset
$self->{changeset}=$res->content;
return 1;
}
-
+
$self->{last_error} = $res;
$self->{changeset}=undef;
return 0;
-
+
}
sub close_changeset
@@ -144,7 +144,7 @@ sub close_changeset
return 1;
}
return 0;
-
+
}
sub create($)
@@ -156,18 +156,18 @@ sub create($)
$ent->set_id($oldid);
my $req = new HTTP::Request PUT => $self->{url}."/".$ent->type()."/create";
$req->content($content);
-
+
# print $req->as_string;
-
+
my $res = $self->_request($req);
-
+
# print $res->as_string;
if( $res->code == 200 )
{
return $res->content
}
-
+
$self->{last_error} = $res;
return undef;
}
@@ -179,11 +179,11 @@ sub modify($)
my $content = encode("utf-8", $ent->full_xml);
my $req = new HTTP::Request PUT => $self->{url}."/".$ent->type()."/".$ent->id();
$req->content($content);
-
+
# print $req->as_string;
-
+
my $res = $self->_request($req);
-
+
return $ent->id() if $res->code == 200;
$self->{last_error} = $res;
return undef;
@@ -196,11 +196,11 @@ sub delete($)
my $content = encode("utf-8", $ent->full_xml);
my $req = new HTTP::Request DELETE => $self->{url}."/".$ent->type()."/".$ent->id();
$req->content($content);
-
+
# print $req->as_string;
-
+
my $res = $self->_request($req);
-
+
return $ent->id() if $res->code == 200;
$self->{last_error} = $res;
return undef;
@@ -212,12 +212,12 @@ sub get($$)
my $type = shift;
my $id = shift;
my $extra = shift;
-
+
$extra = "/".$extra if (defined $extra);
$extra = "" if not defined $extra;
my $req = new HTTP::Request GET => $self->{url}."/$type/$id$extra";
-
+
my $res = $self->_request($req);
if( $res->code != 200 )
@@ -225,7 +225,7 @@ sub get($$)
$self->{last_error} = $res;
return undef;
}
-
+
my @res;
$self->{buffer} = \@res;
$self->{reader}->parse($res->content);
@@ -252,7 +252,7 @@ sub resurrect($$)
if (defined $ret || !defined $self->{last_error} || ($self->{last_error}->code != 410)) {
return $ret;
}
-
+
my @ents = $self->get($type, $id, 'history');
# we want the last _visible_ one
my $ent = $ents[-2];
@@ -307,9 +307,9 @@ sub get_subtype($$)
my $type = shift;
my $id = shift;
my $subtype = shift;
-
+
my $req = new HTTP::Request GET => $self->{url}."/$type/$id/$subtype";
-
+
my $res = $self->_request($req);
if( $res->code != 200 )
@@ -317,7 +317,7 @@ sub get_subtype($$)
$self->{last_error} = $res;
return undef;
}
-
+
my @res;
$self->{buffer} = \@res;
$self->{reader}->parse($res->content);
@@ -326,7 +326,7 @@ sub get_subtype($$)
{
die "Unexpected response for get_subtype($type,$id,$subtype) [".$res->content()."]\n";
}
-
+
return \@res;
}
@@ -334,7 +334,7 @@ sub get_node_ways($)
{
my $self = shift;
my $id = shift;
-
+
return $self->get_subtype("node",$id,"ways");
}
@@ -342,9 +342,9 @@ sub map($$$$)
{
my $self = shift;
my @bbox = @_;
-
+
my $req = new HTTP::Request GET => $self->{url}."/map?bbox=$bbox[0],$bbox[1],$bbox[2],$bbox[3]";
-
+
my $res = $self->_request($req);
if( $res->code != 200 )
@@ -352,12 +352,12 @@ sub map($$$$)
$self->{last_error} = $res;
return undef;
}
-
+
my @res;
$self->{buffer} = \@res;
$self->{reader}->parse($res->content);
undef $self->{buffer};
-
+
return \@res;
}
diff --git a/navit/script/osm/Geo/OSM/EntitiesV3.pm b/navit/script/osm/Geo/OSM/EntitiesV3.pm
index 2708463c7..0e0581af4 100644
--- a/navit/script/osm/Geo/OSM/EntitiesV3.pm
+++ b/navit/script/osm/Geo/OSM/EntitiesV3.pm
@@ -67,9 +67,9 @@ sub tag_xml
{
my ($self,$writer) = @_;
my @a = @{$self->{tags}};
-
+
my $str = "";
-
+
while( my($k,$v) = splice @a, 0, 2 )
{
$writer->emptyTag( "tag", 'k' => $k, 'v' => $v );
@@ -83,9 +83,9 @@ sub set_id
my($self,$id) = @_;
if( not defined $id )
- { $id = $_ID-- }
+ { $id = $_ID-- }
$self->{id} = $id;
-}
+}
sub id
{
@@ -120,14 +120,14 @@ our @ISA = qw(Geo::OSM::Entity);
sub new
{
my($class, $attr, $tags, $segs) = @_;
-
+
my $obj = bless $class->SUPER::_new(), $class;
-
+
$obj->set_tags($tags);
$obj->set_segs($segs);
$obj->set_id($attr->{id} );
$obj->set_timestamp( $attr->{timestamp} );
-
+
return $obj;
}
@@ -168,11 +168,11 @@ sub map
my $incomplete = 0;
my ($new_id) = $mapper->map('way',$self->id); # Determine mapped ID
# It is ok for the new_id to be incomplete; it may be a create request
-
+
my @new_segs = map { [ $mapper->map('segment',$_) ] } @{$self->segs};
map { $incomplete |= $_->[1] } @new_segs;
# incomplete tracks if any of the segs are incomplete
-
+
my $new_ent = new Geo::OSM::Way( {id=>$new_id, timestamp=>$self->timestamp}, $self->tags, [map {$_->[0]} @new_segs] );
return($new_ent,$incomplete);
}
@@ -183,15 +183,15 @@ our @ISA = qw(Geo::OSM::Entity);
sub new
{
my($class, $attr, $tags) = @_;
-
+
my $obj = bless $class->SUPER::_new(), $class;
-
+
$obj->set_tags($tags);
$obj->set_id($attr->{id} );
$obj->set_timestamp( $attr->{timestamp} );
$obj->{from} = $attr->{from};
$obj->{to} = $attr->{to};
-
+
return $obj;
}
@@ -242,15 +242,15 @@ our @ISA = qw(Geo::OSM::Entity);
sub new
{
my($class, $attr, $tags) = @_;
-
+
my $obj = bless $class->SUPER::_new(), $class;
-
+
$obj->set_tags($tags);
$obj->set_id($attr->{id} );
$obj->set_timestamp( $attr->{timestamp} );
$obj->{lon} = $attr->{lon};
$obj->{lat} = $attr->{lat};
-
+
return $obj;
}
@@ -277,7 +277,7 @@ sub xml
my $self = shift;
my $str = "";
my $writer = $self->_get_writer(\$str);
-
+
$writer->startTag( "node", id => $self->id, lat => $self->lat, lon => $self->lon, timestamp => $self->timestamp );
$self->tag_xml( $writer );
$writer->endTag( "node" );
diff --git a/navit/script/osm/Geo/OSM/EntitiesV5.pm b/navit/script/osm/Geo/OSM/EntitiesV5.pm
index 625ff6b03..fa9116daa 100644
--- a/navit/script/osm/Geo/OSM/EntitiesV5.pm
+++ b/navit/script/osm/Geo/OSM/EntitiesV5.pm
@@ -67,9 +67,9 @@ sub tag_xml
{
my ($self,$writer) = @_;
my @a = @{$self->{tags}};
-
+
my $str = "";
-
+
while( my($k,$v) = splice @a, 0, 2 )
{
$writer->emptyTag( "tag", 'k' => $k, 'v' => $v );
@@ -83,9 +83,9 @@ sub set_id
my($self,$id) = @_;
if( not defined $id )
- { $id = $_ID-- }
+ { $id = $_ID-- }
$self->{id} = $id;
-}
+}
sub id
{
@@ -121,14 +121,14 @@ use Carp;
sub new
{
my($class, $attr, $tags, $nodes) = @_;
-
+
my $obj = bless $class->SUPER::_new(), $class;
-
+
$obj->set_tags($tags);
$obj->set_nodes($nodes);
$obj->set_id($attr->{id} );
$obj->set_timestamp( $attr->{timestamp} );
-
+
return $obj;
}
@@ -175,11 +175,11 @@ sub map
my $incomplete = 0;
my ($new_id) = $mapper->map('way',$self->id); # Determine mapped ID
# It is ok for the new_id to be incomplete; it may be a create request
-
+
my @new_nodes = map { [ $mapper->map('node',$_) ] } @{$self->nodes};
map { $incomplete |= $_->[1] } @new_nodes;
# incomplete tracks if any of the segs are incomplete
-
+
my $new_ent = new Geo::OSM::Way( {id=>$new_id, timestamp=>$self->timestamp}, $self->tags, [map {$_->[0]} @new_nodes] );
return($new_ent,$incomplete);
}
@@ -204,7 +204,7 @@ sub new
{ $arg = { type => $arg->[0], ref => $arg->[1], role => $arg->[2] } }
}
if( ref($arg) eq "HASH" )
- {
+ {
if( ref $arg->{ref} )
{ $arg = [ $arg->{ref}->type, $arg->{ref}->id, $arg->{role} ] }
else
@@ -217,7 +217,7 @@ sub new
croak "Bad member id '$arg->[1]'"
unless $arg->[1] =~ /^-?\d+$/;
$arg->[2] ||= "";
-
+
return bless $arg, $class;
}
@@ -249,14 +249,14 @@ our @ISA = qw(Geo::OSM::Entity);
sub new
{
my($class, $attr, $tags, $members) = @_;
-
+
my $obj = bless $class->SUPER::_new(), $class;
-
+
$obj->set_tags($tags);
$obj->set_members($members);
$obj->set_id($attr->{id} );
$obj->set_timestamp( $attr->{timestamp} );
-
+
return $obj;
}
@@ -298,7 +298,7 @@ sub map
{
my($self,$mapper) = @_;
my $incomplete = 0;
-
+
my ($new_id) = $mapper->map('relation',$self->id);
my @new_members = map { [ $_->map($mapper) ] } @{$self->members};
map { $incomplete |= $_->[1] } @new_members;
@@ -314,9 +314,9 @@ our @ISA = qw(Geo::OSM::Entity);
sub new
{
my($class, $attr, $tags) = @_;
-
+
my $obj = bless $class->SUPER::_new(), $class;
-
+
$obj->set_tags($tags);
$obj->set_id($attr->{id} );
$obj->set_timestamp( $attr->{timestamp} );
@@ -327,7 +327,7 @@ sub new
}
$obj->{lon} = $attr->{lon};
$obj->{lat} = $attr->{lat};
-
+
return $obj;
}
@@ -354,7 +354,7 @@ sub xml
my $self = shift;
my $str = "";
my $writer = $self->_get_writer(\$str);
-
+
$writer->startTag( "node", id => $self->id, lat => $self->lat, lon => $self->lon, timestamp => $self->timestamp );
$self->tag_xml( $writer );
$writer->endTag( "node" );
diff --git a/navit/script/osm/Geo/OSM/EntitiesV6.pm b/navit/script/osm/Geo/OSM/EntitiesV6.pm
index 8747c17f0..4a9b49cbb 100644
--- a/navit/script/osm/Geo/OSM/EntitiesV6.pm
+++ b/navit/script/osm/Geo/OSM/EntitiesV6.pm
@@ -67,9 +67,9 @@ sub tag_xml
{
my ($self,$writer) = @_;
my @a = @{$self->{tags}};
-
+
my $str = "";
-
+
while( my($k,$v) = splice @a, 0, 2 )
{
$writer->emptyTag( "tag", 'k' => $k, 'v' => $v );
@@ -83,9 +83,9 @@ sub set_id
my($self,$id) = @_;
if( not defined $id )
- { $id = $_ID-- }
+ { $id = $_ID-- }
$self->{id} = $id;
-}
+}
sub id
{
@@ -143,16 +143,16 @@ use Carp;
sub new
{
my($class, $attr, $tags, $nodes) = @_;
-
+
my $obj = bless $class->SUPER::_new(), $class;
-
+
$obj->set_tags($tags);
$obj->set_nodes($nodes);
$obj->set_id($attr->{id} );
$obj->set_timestamp( $attr->{timestamp} );
$obj->set_changeset( $attr->{changeset} );
$obj->set_version( $attr->{version} );
-
+
return $obj;
}
@@ -199,11 +199,11 @@ sub map
my $incomplete = 0;
my ($new_id) = $mapper->map('way',$self->id); # Determine mapped ID
# It is ok for the new_id to be incomplete; it may be a create request
-
+
my @new_nodes = map { [ $mapper->map('node',$_) ] } @{$self->nodes};
map { $incomplete |= $_->[1] } @new_nodes;
# incomplete tracks if any of the segs are incomplete
-
+
my $new_ent = new Geo::OSM::Way( {id=>$new_id, timestamp=>$self->timestamp}, $self->tags, [map {$_->[0]} @new_nodes] );
return($new_ent,$incomplete);
}
@@ -228,7 +228,7 @@ sub new
{ $arg = { type => $arg->[0], ref => $arg->[1], role => $arg->[2] } }
}
if( ref($arg) eq "HASH" )
- {
+ {
if( ref $arg->{ref} )
{ $arg = [ $arg->{ref}->type, $arg->{ref}->id, $arg->{role} ] }
else
@@ -241,7 +241,7 @@ sub new
croak "Bad member id '$arg->[1]'"
unless $arg->[1] =~ /^-?\d+$/;
$arg->[2] ||= "";
-
+
return bless $arg, $class;
}
@@ -273,16 +273,16 @@ our @ISA = qw(Geo::OSM::Entity);
sub new
{
my($class, $attr, $tags, $members) = @_;
-
+
my $obj = bless $class->SUPER::_new(), $class;
-
+
$obj->set_tags($tags);
$obj->set_members($members);
$obj->set_id($attr->{id} );
$obj->set_timestamp( $attr->{timestamp} );
$obj->set_changeset( $attr->{changeset} );
$obj->set_version( $attr->{version} );
-
+
return $obj;
}
@@ -324,7 +324,7 @@ sub map
{
my($self,$mapper) = @_;
my $incomplete = 0;
-
+
my ($new_id) = $mapper->map('relation',$self->id);
my @new_members = map { [ $_->map($mapper) ] } @{$self->members};
map { $incomplete |= $_->[1] } @new_members;
@@ -341,9 +341,9 @@ our @ISA = qw(Geo::OSM::Entity);
sub new
{
my($class, $attr, $tags) = @_;
-
+
my $obj = bless $class->SUPER::_new(), $class;
-
+
$obj->set_tags($tags);
$obj->set_id($attr->{id} );
$obj->set_timestamp( $attr->{timestamp} );
@@ -356,7 +356,7 @@ sub new
}
$obj->{lon} = $attr->{lon};
$obj->{lat} = $attr->{lat};
-
+
return $obj;
}
@@ -383,7 +383,7 @@ sub xml
my $self = shift;
my $str = "";
my $writer = $self->_get_writer(\$str);
-
+
$writer->startTag( "node", id => $self->id, lat => $self->lat, lon => $self->lon, timestamp => $self->timestamp, changeset => $self->changeset, version => $self->version);
$self->tag_xml( $writer );
$writer->endTag( "node" );
diff --git a/navit/script/osm/Geo/OSM/MapFeatures.pm b/navit/script/osm/Geo/OSM/MapFeatures.pm
index c4ae62f89..473ff20de 100644
--- a/navit/script/osm/Geo/OSM/MapFeatures.pm
+++ b/navit/script/osm/Geo/OSM/MapFeatures.pm
@@ -49,7 +49,7 @@ sub load($;$){
return;
}
my $self = XMLin($fh);
-
+
if (not $self) {
print STDERR "WARNING: Could not parse osm data from $filename\n";
return;
@@ -61,7 +61,7 @@ sub load($;$){
#warn Dumper(\$self->{rule});
#warn Dumper(keys %{$self});
#warn Dumper(%{$self});
-
+
bless($self,$class);
return $self;
}
@@ -97,7 +97,7 @@ sub load_icons($$){
last;
}
}
-
+
if ( ! $rule->{png} ) {
warn "missing $img\n";
}
@@ -139,7 +139,7 @@ sub get_icons($$$){
my $condition = $rule->{condition};
# print STDERR "condition: $condition->{k}=$condition->{v}\n";
- if ( defined ( $attr{scale_max}) &&
+ if ( defined ( $attr{scale_max}) &&
$scale > $attr{scale_max}) {
next;
}
@@ -150,7 +150,7 @@ sub get_icons($$$){
print STDERR "get_icon() image: $img\t";
$png = $rule->{png};
}
-
+
return $png if $png;
}
return undef;
diff --git a/navit/script/osm/Geo/OSM/OsmChangeReaderV3.pm b/navit/script/osm/Geo/OSM/OsmChangeReaderV3.pm
index 65103a36e..ff99e4043 100644
--- a/navit/script/osm/Geo/OSM/OsmChangeReaderV3.pm
+++ b/navit/script/osm/Geo/OSM/OsmChangeReaderV3.pm
@@ -32,7 +32,7 @@ use constant FILETYPE_OSMCHANGE => 1;
use constant FILETYPE_OSM => 2;
sub new
-{
+{
my $obj = bless{}, shift;
my $proc = shift;
my $prog = shift;
@@ -46,7 +46,7 @@ sub new
# With this initialiser, your process will get called with instantiated objects rather than useless details
sub init
-{
+{
my $obj = bless{}, shift;
my $proc = shift;
my $prog = shift;
@@ -61,12 +61,12 @@ sub init
sub _process
{
my($self, $command, $entity, $attr, $tags, $segs) = @_;
-
+
if( defined $self->{oldproc} )
{
return $self->{oldproc}->($command, $entity, $attr, $tags, $segs);
}
-
+
my $ent;
if( $entity eq "node" )
{
@@ -90,7 +90,7 @@ sub load{
$self->{filetype} = FILETYPE_UNKNOWN;
$self->{state} = STATE_INIT;
-
+
my $start_time = time();
my $P = new XML::Parser(Handlers => {Start => sub{ DoStart( $self, @_ )}, End => sub { DoEnd( $self, @_ )}});
my $fh = data_open($file_name);
@@ -120,7 +120,7 @@ sub parse($)
my ($self, $string) = @_;
$self->{state} = STATE_INIT;
-
+
my $start_time = time();
my $P = new XML::Parser(Handlers => {Start => sub{ DoStart( $self, @_ )}, End => sub { DoEnd( $self, @_ )}});
$self->{input_length} = length($string);
@@ -145,7 +145,7 @@ sub parse($)
# Function is called whenever an XML tag is started
sub DoStart
{
-#print @_,"\n";
+#print @_,"\n";
my ($self, $Expat, $Name, %Attr) = @_;
if( $self->{filetype} == FILETYPE_UNKNOWN )
@@ -161,7 +161,7 @@ sub DoStart
} elsif($Name eq "osm"){
$self->{state} = STATE_EXPECT_ENTITY;
$self->{filetype} = FILETYPE_OSM;
-
+
if( $Attr{version} ne "0.3" and $Attr{version} ne "0.4" )
{ die "OsmChangeReaderV3 can only read 0.3 and 0.4 files, found '$Attr{version}'\n" }
} else {
@@ -284,7 +284,7 @@ OsmChangeReaderV3 - Module for reading OpenStreetMap V3 Change XML data files
my $OSM = new Geo::OSM::OsmChangeReader(\&process);
$OSM->load("Data/changes.osc");
-
+
sub process
{
my($OSM, $command, $entity, $attr, $tags, $segs) = @_;
diff --git a/navit/script/osm/Geo/OSM/OsmChangeReaderV5.pm b/navit/script/osm/Geo/OSM/OsmChangeReaderV5.pm
index fdc65e1a9..50dfeea6d 100644
--- a/navit/script/osm/Geo/OSM/OsmChangeReaderV5.pm
+++ b/navit/script/osm/Geo/OSM/OsmChangeReaderV5.pm
@@ -33,7 +33,7 @@ use constant FILETYPE_OSM => 2;
# With this initialiser, your process will get called with instantiated objects
sub init
-{
+{
my $obj = bless{}, shift;
my $proc = shift;
my $prog = shift;
@@ -48,12 +48,12 @@ sub init
sub _process
{
my($self, $command, $entity, $attr, $tags, $members) = @_;
-
+
if( defined $self->{oldproc} )
{
return $self->{oldproc}->($command, $entity, $attr, $tags, $members);
}
-
+
my $ent;
if( $entity eq "node" )
{
@@ -77,7 +77,7 @@ sub load{
$self->{filetype} = FILETYPE_UNKNOWN;
$self->{state} = STATE_INIT;
-
+
my $start_time = time();
my $P = new XML::Parser(Handlers => {Start => sub{ DoStart( $self, @_ )}, End => sub { DoEnd( $self, @_ )}});
my $fh = data_open($file_name);
@@ -107,7 +107,7 @@ sub parse($)
my ($self, $string) = @_;
$self->{state} = STATE_INIT;
-
+
my $start_time = time();
my $P = new XML::Parser(Handlers => {Start => sub{ DoStart( $self, @_ )}, End => sub { DoEnd( $self, @_ )}});
$self->{input_length} = length($string);
@@ -132,7 +132,7 @@ sub parse($)
# Function is called whenever an XML tag is started
sub DoStart
{
-#print @_,"\n";
+#print @_,"\n";
my ($self, $Expat, $Name, %Attr) = @_;
if( $self->{filetype} == FILETYPE_UNKNOWN )
@@ -148,7 +148,7 @@ sub DoStart
} elsif($Name eq "osm"){
$self->{state} = STATE_EXPECT_ENTITY;
$self->{filetype} = FILETYPE_OSM;
-
+
if( $Attr{version} ne "0.5" )
{ die "OsmChangeReaderV3 can only read 0.5 files, found '$Attr{version}'\n" }
} else {
@@ -276,7 +276,7 @@ OsmChangeReaderV5 - Module for reading OpenStreetMap V5 Change XML data files
my $OSM = new Geo::OSM::OsmChangeReader(\&process);
$OSM->load("Data/changes.osc");
-
+
sub process
{
my($OSM, $command, $entity) = @_;
diff --git a/navit/script/osm/Geo/OSM/OsmChangeReaderV6.pm b/navit/script/osm/Geo/OSM/OsmChangeReaderV6.pm
index e67397829..4e312f519 100644
--- a/navit/script/osm/Geo/OSM/OsmChangeReaderV6.pm
+++ b/navit/script/osm/Geo/OSM/OsmChangeReaderV6.pm
@@ -33,7 +33,7 @@ use constant FILETYPE_OSM => 2;
# With this initialiser, your process will get called with instantiated objects
sub init
-{
+{
my $obj = bless{}, shift;
my $proc = shift;
my $prog = shift;
@@ -48,12 +48,12 @@ sub init
sub _process
{
my($self, $command, $entity, $attr, $tags, $members) = @_;
-
+
if( defined $self->{oldproc} )
{
return $self->{oldproc}->($command, $entity, $attr, $tags, $members);
}
-
+
my $ent;
if( $entity eq "node" )
{
@@ -77,7 +77,7 @@ sub load{
$self->{filetype} = FILETYPE_UNKNOWN;
$self->{state} = STATE_INIT;
-
+
my $start_time = time();
my $P = new XML::Parser(Handlers => {Start => sub{ DoStart( $self, @_ )}, End => sub { DoEnd( $self, @_ )}});
my $fh = data_open($file_name);
@@ -107,7 +107,7 @@ sub parse($)
my ($self, $string) = @_;
$self->{state} = STATE_INIT;
-
+
my $start_time = time();
my $P = new XML::Parser(Handlers => {Start => sub{ DoStart( $self, @_ )}, End => sub { DoEnd( $self, @_ )}});
$self->{input_length} = length($string);
@@ -132,7 +132,7 @@ sub parse($)
# Function is called whenever an XML tag is started
sub DoStart
{
-#print @_,"\n";
+#print @_,"\n";
my ($self, $Expat, $Name, %Attr) = @_;
if( $self->{filetype} == FILETYPE_UNKNOWN )
@@ -148,7 +148,7 @@ sub DoStart
} elsif($Name eq "osm"){
$self->{state} = STATE_EXPECT_ENTITY;
$self->{filetype} = FILETYPE_OSM;
-
+
if( $Attr{version} ne "0.6" )
{ die "OsmChangeReaderV6 can only read 0.6 files, found '$Attr{version}'\n" }
} else {
@@ -276,7 +276,7 @@ OsmChangeReaderV6 - Module for reading OpenStreetMap V6 Change XML data files
my $OSM = new Geo::OSM::OsmChangeReader(\&process);
$OSM->load("Data/changes.osc");
-
+
sub process
{
my($OSM, $command, $entity) = @_;
diff --git a/navit/script/osm/Geo/OSM/OsmReaderV3.pm b/navit/script/osm/Geo/OSM/OsmReaderV3.pm
index b01963470..6cc64b899 100644
--- a/navit/script/osm/Geo/OSM/OsmReaderV3.pm
+++ b/navit/script/osm/Geo/OSM/OsmReaderV3.pm
@@ -26,7 +26,7 @@ use constant STATE_EXPECT_BODY => 4;
# With this initialiser, your process will get called with instantiated objects
sub init
-{
+{
my $obj = bless{}, shift;
my $proc = shift;
my $prog = shift;
@@ -41,7 +41,7 @@ sub init
sub _process
{
my($self, $entity, $attr, $tags, $members) = @_;
-
+
my $ent;
if( $entity eq "node" )
{
@@ -65,7 +65,7 @@ sub load($)
my ($self, $file_name) = @_;
$self->{state} = STATE_INIT;
-
+
my $start_time = time();
my $P = new XML::Parser(Handlers => {Start => sub{ DoStart( $self, @_ )}, End => sub { DoEnd( $self, @_ )}});
my $fh = data_open($file_name);
@@ -94,7 +94,7 @@ sub parse($)
my ($self, $string) = @_;
$self->{state} = STATE_INIT;
-
+
my $start_time = time();
my $P = new XML::Parser(Handlers => {Start => sub{ DoStart( $self, @_ )}, End => sub { DoEnd( $self, @_ )}});
$self->{input_length} = length($string);
@@ -119,14 +119,14 @@ sub parse($)
# Function is called whenever an XML tag is started
sub DoStart
{
-#print @_,"\n";
+#print @_,"\n";
my ($self, $Expat, $Name, %Attr) = @_;
if( $self->{state} == STATE_INIT )
{
if($Name eq "osm"){
$self->{state} = STATE_EXPECT_ENTITY;
-
+
if( $Attr{version} ne "0.3" and $Attr{version} ne "0.4")
{ die "OsmReaderV5 can only read 0.3 or 0.4 files, found '$Attr{version}'\n" }
} else {
@@ -206,7 +206,7 @@ OsmReaderV3 - Module for reading OpenStreetMap V3 XML data files
my $OSM = new Geo::OSM::OsmReader(\&process);
$OSM->load("Data/changes.osc");
-
+
sub process
{
my($OSM, $entity) = @_;
diff --git a/navit/script/osm/Geo/OSM/OsmReaderV5.pm b/navit/script/osm/Geo/OSM/OsmReaderV5.pm
index 37a477b1a..315e4dddf 100644
--- a/navit/script/osm/Geo/OSM/OsmReaderV5.pm
+++ b/navit/script/osm/Geo/OSM/OsmReaderV5.pm
@@ -26,7 +26,7 @@ use constant STATE_EXPECT_BODY => 4;
# With this initialiser, your process will get called with instantiated objects
sub init
-{
+{
my $obj = bless{}, shift;
my $proc = shift;
my $prog = shift;
@@ -41,7 +41,7 @@ sub init
sub _process
{
my($self, $entity, $attr, $tags, $members) = @_;
-
+
my $ent;
if( $entity eq "node" )
{
@@ -65,7 +65,7 @@ sub load($)
my ($self, $file_name) = @_;
$self->{state} = STATE_INIT;
-
+
my $start_time = time();
my $P = new XML::Parser(Handlers => {Start => sub{ DoStart( $self, @_ )}, End => sub { DoEnd( $self, @_ )}});
my $fh = data_open($file_name);
@@ -94,7 +94,7 @@ sub parse($)
my ($self, $string) = @_;
$self->{state} = STATE_INIT;
-
+
my $start_time = time();
my $P = new XML::Parser(Handlers => {Start => sub{ DoStart( $self, @_ )}, End => sub { DoEnd( $self, @_ )}});
$self->{input_length} = length($string);
@@ -119,14 +119,14 @@ sub parse($)
# Function is called whenever an XML tag is started
sub DoStart
{
-#print @_,"\n";
+#print @_,"\n";
my ($self, $Expat, $Name, %Attr) = @_;
if( $self->{state} == STATE_INIT )
{
if($Name eq "osm"){
$self->{state} = STATE_EXPECT_ENTITY;
-
+
if( $Attr{version} ne "0.5" )
{ die "OsmReaderV5 can only read 0.5 files, found '$Attr{version}'\n" }
} else {
@@ -209,7 +209,7 @@ OsmReaderV5 - Module for reading OpenStreetMap V5 XML data files
my $OSM = new Geo::OSM::OsmReader(\&process);
$OSM->load("Data/changes.osc");
-
+
sub process
{
my($OSM, $entity) = @_;
diff --git a/navit/script/osm/Geo/OSM/OsmReaderV6.pm b/navit/script/osm/Geo/OSM/OsmReaderV6.pm
index 4f6a683d2..7ad3c736a 100644
--- a/navit/script/osm/Geo/OSM/OsmReaderV6.pm
+++ b/navit/script/osm/Geo/OSM/OsmReaderV6.pm
@@ -26,7 +26,7 @@ use constant STATE_EXPECT_BODY => 4;
# With this initialiser, your process will get called with instantiated objects
sub init
-{
+{
my $obj = bless{}, shift;
my $proc = shift;
my $prog = shift;
@@ -41,7 +41,7 @@ sub init
sub _process
{
my($self, $entity, $attr, $tags, $members) = @_;
-
+
my $ent;
if( $entity eq "node" )
{
@@ -65,7 +65,7 @@ sub load($)
my ($self, $file_name) = @_;
$self->{state} = STATE_INIT;
-
+
my $start_time = time();
my $P = new XML::Parser(Handlers => {Start => sub{ DoStart( $self, @_ )}, End => sub { DoEnd( $self, @_ )}});
my $fh = data_open($file_name);
@@ -94,7 +94,7 @@ sub parse($)
my ($self, $string) = @_;
$self->{state} = STATE_INIT;
-
+
my $start_time = time();
my $P = new XML::Parser(Handlers => {Start => sub{ DoStart( $self, @_ )}, End => sub { DoEnd( $self, @_ )}});
$self->{input_length} = length($string);
@@ -119,14 +119,14 @@ sub parse($)
# Function is called whenever an XML tag is started
sub DoStart
{
-#print @_,"\n";
+#print @_,"\n";
my ($self, $Expat, $Name, %Attr) = @_;
if( $self->{state} == STATE_INIT )
{
if($Name eq "osm"){
$self->{state} = STATE_EXPECT_ENTITY;
-
+
if( $Attr{version} ne "0.6" )
{ die "OsmReaderV6 can only read 0.6 files, found '$Attr{version}'\n" }
} else {
@@ -209,7 +209,7 @@ OsmReaderV6 - Module for reading OpenStreetMap V6 XML data files
my $OSM = new Geo::OSM::OsmReader(\&process);
$OSM->load("Data/changes.osc");
-
+
sub process
{
my($OSM, $entity) = @_;
diff --git a/navit/script/osm/Geo/OSM/OsmXML.pm b/navit/script/osm/Geo/OSM/OsmXML.pm
index 60f458db7..f37d269c3 100644
--- a/navit/script/osm/Geo/OSM/OsmXML.pm
+++ b/navit/script/osm/Geo/OSM/OsmXML.pm
@@ -51,7 +51,7 @@ sub bounds(){
sub DoStart()
{
my ($Expat, $Name, %Attr) = @_;
-
+
if($Name eq "node"){
undef %OsmXML::Tags;
%OsmXML::MainAttr = %Attr;
@@ -97,7 +97,7 @@ sub DoEnd(){
$OsmXML::Ways{$ID}{"segments"} = join(",",@OsmXML::WaySegments);
foreach(keys(%OsmXML::Tags)){
$OsmXML::Ways{$ID}{$_} = $OsmXML::Tags{$_};
- }
+ }
}
}
@@ -118,16 +118,16 @@ OsmXML - Module for reading OpenStreetMap XML data files
$OSM = new OsmXML();
$OSM->load("Data/nottingham.osm");
-
+
foreach $Way(%OsmXML::Ways){
@Segments = split(/,/, $Way->{"segments"});
-
+
foreach $SegmentID(@Segments){
$Segment = $OsmXML::Segments{$SegmentID};
-
+
$Node1 = $OsmXML::Nodes{$Segment->{"from"}};
$Node2 = $OsmXML::Nodes{$Segment->{"to"}};
-
+
printf "Node at %f,%f, named %s, is a %s",
$Node2->{"lat"},
$Node2->{"lon"},
diff --git a/navit/script/osm/Geo/OSM/Planet.pm b/navit/script/osm/Geo/OSM/Planet.pm
index 25c533eb7..260b96b5f 100644
--- a/navit/script/osm/Geo/OSM/Planet.pm
+++ b/navit/script/osm/Geo/OSM/Planet.pm
@@ -64,10 +64,10 @@ my $estimations = {
};
# ------------------------------------------------------------------
-# This routine estimates the maximum id for way,elem,seg,...
+# This routine estimates the maximum id for way,elem,seg,...
# The values are taken from older planet.osm Files
# So they mostly are a little bit to low
-# ARGS:
+# ARGS:
# $type: line|way|tag|...
# RETURNS:
# $result: number of estimated max_id
@@ -81,10 +81,10 @@ sub estimated_max_id($){
}
# ------------------------------------------------------------------
-# This routine estimates the maximim number of elements for way,elem,seg,...
+# This routine estimates the maximim number of elements for way,elem,seg,...
# The values are taken from older planet.osm Files
# So they mostly are a little bit to low
-# ARGS:
+# ARGS:
# $type: line|way|tag|...
# RETURNS:
# $result: number of estimated elements
@@ -112,7 +112,7 @@ sub osm_dir() {
chomp $home;
$home = "/home/$home";
}
-
+
$dir = "$home/osm";
return $dir;
}
@@ -144,22 +144,22 @@ sub sort_unique(@){
}
return @erg
}
-
+
# ------------------------------------------------------------------
# mirror the newest planet.osm File to
# ~/osm/planet/planet.osm.bz2
-# and the resulting
+# and the resulting
# Filename is returned
#
-# the file is -----NO LONGER--- Sanitized afterwards
+# the file is -----NO LONGER--- Sanitized afterwards
sub mirror_planet(){
my $planet_server="http://planet.openstreetmap.org";
my $url = "$planet_server";
my $mirror_dir=planet_dir();
mkdir_if_needed( $mirror_dir );
-
+
my $current_file;
if ( !$Utils::LWP::Utils::NO_MIRROR ) {
# Get Index.html of Planet.osm.org
@@ -194,11 +194,11 @@ sub mirror_planet(){
print STDERR "Existing Files: \n\t".join("\n\t",@files)."\n";
}
$current_file = $files[0];
-
+
if ( $DEBUG) {
print STDERR "Chosen File: $current_file\n";
}
-
+
return undef unless $current_file;
# $current_file = UTF8sanitize($current_file);
@@ -220,7 +220,7 @@ sub mirror_planet(){
# ~/osm/planet/planet-07XXXX-a.osm.bz2
# If a recent enought Version is found in ~/osm/planet/
# nothing is done, but the filename of the file is returned
-# if the routine finds an uncompressed up to date Version
+# if the routine finds an uncompressed up to date Version
# ~/osm/planet/planet-07XXXX-a.osm
# this Filename is returned.
sub UTF8sanitize($){
@@ -259,7 +259,7 @@ sub UTF8sanitize($){
print "Command: $cmd" if $DEBUG || $VERBOSE;
my $result = `$cmd`;
print $result if $DEBUG || $VERBOSE;
-
+
print "Sanitized $filename " if $DEBUG || $VERBOSE;
print_time($start_time);
@@ -279,7 +279,7 @@ sub UTF8sanitize($){
}
# ------------------------------------------------------------------
-# find a file in the current Perl Search path. For now this was the
+# find a file in the current Perl Search path. For now this was the
# easiest solution to find programms like UTF8Sanitize
# ARGS: relative filename (relative to @INC-path
# RETURNS: Absolute path to file
@@ -295,7 +295,7 @@ sub find_file_in_perl_path($){
last;
};
}
-
+
print "find_file_in_perl_path($file): --> $found_file\n" if $DEBUG;
return $found_file;
}
diff --git a/navit/script/osm/Geo/OSM/SegmentList.pm b/navit/script/osm/Geo/OSM/SegmentList.pm
index 0de35ebf5..8523173ce 100644
--- a/navit/script/osm/Geo/OSM/SegmentList.pm
+++ b/navit/script/osm/Geo/OSM/SegmentList.pm
@@ -54,7 +54,7 @@ sub load_segment_list($;$){
my $osm_filename = "${path}/csv/osm-segments.csv";
$osm_filename =~ s,\~/,$home/,;
printf STDERR "check $osm_filename for loading\n" if $DEBUG;
-
+
die "Cannot open $osm_filename\n" unless -s $osm_filename;
$osm_segments = Geo::OSM::SegmentList::LoadOSM_segment_csv($osm_filename, $bounds);
};
@@ -111,7 +111,7 @@ sub LoadOSM_segment_csv($;$){
$main::dont_write_osm_storable=1 || $check_bounds;
$main::dont_read_osm_storable=1;
- if ( -s "$filename.storable" &&
+ if ( -s "$filename.storable" &&
! file_needs_re_generation($filename,"$filename.storable")
&& ! $main::dont_read_osm_storable ) {
# later we should compare if the file also is newer than the source
@@ -178,7 +178,7 @@ sub LoadOSM_segment_csv($;$){
# -------------------------------------------------------
# Load the segment list from postgis
# Args: {lat_min=> .., lat_max => ..., lon_min => .., lon_max => .. }
-# This is a test to see if we can handle all segments of the world
+# This is a test to see if we can handle all segments of the world
# with reasonable query times
sub LoadOSM_segment_postgis($;$){
my $bounds = shift;
@@ -192,7 +192,7 @@ sub LoadOSM_segment_postgis($;$){
my $sth;
use DBI;
-
+
my $dbname="gis";
my $dbhost="/var/run/postgresql";
my $dbh = DBI->connect("dbi:Pg:dbname=$dbname;host=$dbhost", "", "", {AutoCommit => 0});
@@ -205,7 +205,7 @@ sub LoadOSM_segment_postgis($;$){
# WHERE the_geom && setsrid('BOX(47.36 21.40,51.185 21.53)'::box2d, 42102)
# WHERE GeomFromText('POINT(25.3 25.40)', 42102) && the_geom \
# AND distance(the_geom, GeomFromText('POINT(25.7 5.3)', 42102)) = 0
- # WHERE distance(the_geom, setsrid('BOX(4.36 2.3,1.5 2.8)'::box2d, 42102)) = 0
+ # WHERE distance(the_geom, setsrid('BOX(4.36 2.3,1.5 2.8)'::box2d, 42102)) = 0
# WHERE the_point && setsrid('BOX(295149 2315499, 465992 2163790)'::box2d, -1)
##############################
@@ -223,12 +223,12 @@ sub LoadOSM_segment_postgis($;$){
my $polygon_text=sprintf("POLYGON((%.5f %.5f,%.5f %.5f,%.5f %.5f,%.5f %.5f,%.5f %.5f))",
$bounds->{lat_min}-0.1 , $bounds->{lon_min}-0.1,
- $bounds->{lat_max}+0.1 , $bounds->{lon_min}-0.1 ,
- $bounds->{lat_max}+0.1 , $bounds->{lon_max}+0.1 ,
- $bounds->{lat_min}-0.1 , $bounds->{lon_max}+0.1 ,
+ $bounds->{lat_max}+0.1 , $bounds->{lon_min}-0.1 ,
+ $bounds->{lat_max}+0.1 , $bounds->{lon_max}+0.1 ,
+ $bounds->{lat_min}-0.1 , $bounds->{lon_max}+0.1 ,
$bounds->{lat_min}-0.1 , $bounds->{lon_min}-0.1);
my $polygon="transform(GeomFromText('$polygon_text',${SRID_WGS84}),$SRID_OSM)";
-
+
my $select = "select osm_id,highway,name from planet_osm_line where highway is not null and way && ".
" $polygon ".
"limit 5;";
@@ -240,9 +240,9 @@ sub LoadOSM_segment_postgis($;$){
}
printf STDERR "---------------------------------------------------------------\n" if $DEBUG || $VERBOSE;
-
+
# $select = "SELECT name ,astext(way),$distance FROM planet_osm_roads WHERE $distance < 500 order by $distance;";
-
+
#SELECT * FROM planet_osm_roads WHERE way in ?",
#$select = "SELECT name FROM planet_osm_roads WHERE distance(way,GeomFromText('POINT(856371.58 6683083.41)', 3395)) < 1000;";
# my $distance="distance(way, GeomFromText('POINT(856371.58 6683083.41)', 3395))";
@@ -277,7 +277,7 @@ sub LoadOSM_segment_postgis($;$){
}
printf STDERR "---------------------------------------------------------------\n" if $DEBUG || $VERBOSE;
-
+
my $count=0;
my $count_read=0;
while ( @row = $sth->fetchrow_array ) {
@@ -359,7 +359,7 @@ my $from_node=0;
sub DoStart()
{
my ($Expat, $Name, %Attr) = @_;
-
+
if($Name eq "node"){
undef %Tags;
%MainAttr = %Attr;
@@ -389,7 +389,7 @@ sub DoStart()
my $to_node = $Attr{"ref"};
if ( $from_node &&
defined($Nodes{$from_node}) &&
- defined($Nodes{$to_node})
+ defined($Nodes{$to_node})
) {
my ($lat1,$lon1)=split(",",$Nodes{$from_node});
my ($lat2,$lon2)=split(",",$Nodes{$to_node});
@@ -407,12 +407,12 @@ sub DoStart()
sub DoEnd(){
my ($Expat, $Element) = @_;
my $ID = $MainAttr{"id"};
-
+
if($Element eq "node"){
my $node={};
$node->{"lat"} = $MainAttr{"lat"};
$node->{"lon"} = $MainAttr{"lon"};
-
+
if ( $AREA_FILTER->inside($node) ) {
$Nodes{$ID} = sprintf("%f,%f",$MainAttr{lat}, $MainAttr{lon});
foreach(keys(%Tags)){
@@ -452,16 +452,16 @@ sub read_osm_file($;$) { # Insert Segments from osm File
print("Reading OSM Segment from File $filename\n") if $VERBOSE || $DEBUG;
if ( file_needs_re_generation($filename,"$filename.storable")) {
print "$filename: ".(-s $filename)." Bytes\n" if $DEBUG;
-
+
print STDERR "Parsing file: $filename\n" if $DEBUG;
my $p = new XML::Parser( Handlers => {
- Start => \&DoStart,
- End => \&DoEnd,
+ Start => \&DoStart,
+ End => \&DoEnd,
Char => \&DoChar,
},
ErrorContext => 10,
);
-
+
my $fh = data_open($filename);
if (not $fh) {
print STDERR "WARNING: Could not open osm data from $filename\n";
@@ -476,7 +476,7 @@ sub read_osm_file($;$) { # Insert Segments from osm File
return;
}
#warn Dumper(\$read_osm_segments);
- Storable_save($filename,$read_osm_segments);
+ Storable_save($filename,$read_osm_segments);
} else {
$read_osm_segments=Storable_load($filename);
}
diff --git a/navit/script/osm/Geo/OSM/Tracks2OSM.pm b/navit/script/osm/Geo/OSM/Tracks2OSM.pm
index 4016f8c02..87302abc9 100644
--- a/navit/script/osm/Geo/OSM/Tracks2OSM.pm
+++ b/navit/script/osm/Geo/OSM/Tracks2OSM.pm
@@ -33,7 +33,7 @@ sub create_node($$) {
my $osm_nodes = shift;
my $elem = shift;
- printf STDERR "create_node(): lat or lon undefined : $elem->{lat},$elem->{lon} ".Dumper(\$elem)."\n"
+ printf STDERR "create_node(): lat or lon undefined : $elem->{lat},$elem->{lon} ".Dumper(\$elem)."\n"
unless defined($elem->{lat}) && defined($elem->{lon}) ;
my $id=0;
@@ -95,7 +95,7 @@ sub tracks2osm($){
};
for my $elem ( @{$track} ) {
my $node_id = $elem->{node_id} || create_node($osm_nodes,$elem);
-
+
# -------------------------------------------- Add to Way
push(@{$osm_ways->{$osm_way_number}->{nd}},$node_id);
$count_valid_points_for_ways++;
diff --git a/navit/script/osm/Geo/OSM/Upload.pm b/navit/script/osm/Geo/OSM/Upload.pm
index da18e97ec..7cd4de8cc 100644
--- a/navit/script/osm/Geo/OSM/Upload.pm
+++ b/navit/script/osm/Geo/OSM/Upload.pm
@@ -24,12 +24,12 @@ sub tempfiles(){
sub uploadWay(){
my ($self, $Tags, @Segments) = @_;
$Tags .= sprintf("<tag k=\"created_by\" v=\"%s\"/>", $self->{UserAgent});
-
+
my $Segments = "";
foreach $Segment(@Segments){
$Segments .= "<seg id=\"$Segment\"/>";
}
-
+
my $Way = "<way id=\"0\">$Segments$Tags</way>";
my $OSM = "<osm version=\"0.3\">$Way</osm>";
my $data = "<?xml version=\"1.0\"?>\n$OSM";
@@ -42,45 +42,45 @@ sub uploadWay(){
sub uploadSegment(){
my ($self, $Node1,$Node2,$Tags) = @_;
$Tags .= sprintf("<tag k=\"created_by\" v=\"%s\"/>", $self->{UserAgent});
-
+
my $Segment = sprintf("<segment id=\"0\" from=\"%d\" to=\"%d\">$Tags</segment>", $Node1,$Node2);
my $OSM = "<osm version=\"0.3\">$Segment</osm>";
my $data = "<?xml version=\"1.0\"?>\n$OSM";
my $path = "segment/0";
my ($response, $http_code) = $self->upload($data, $path);
-
-
+
+
return($response);
}
sub uploadNode(){
my ($self, $Lat, $Long, $Tags) = @_;
$Tags .= sprintf("<tag k=\"created_by\" v=\"%s\"/>", $self->{UserAgent});
-
+
my $Node = sprintf("<node id=\"0\" lon=\"%f\" lat=\"%f\">$Tags</node>", $Long, $Lat);
my $OSM = "<osm version=\"0.3\">$Node</osm>";
my $data = "<?xml version=\"1.0\"?>\n$OSM";
my $path = "node/0";
my ($response, $http_code) = $self->upload($data, $path);
-
+
return($response);
}
sub upload(){
my($self, $data, $path) = @_;
-
+
my $curl = new WWW::Curl::easy;
my $login = sprintf("%s:%s", $self->{Username}, $self->{Password});
-
+
open(my $FileToSend, ">", $self->{file1});
print $FileToSend $data;
close $FileToSend;
-
- my $url = "http://www.openstreetmap.org/api/0.3/$path";
-
+
+ my $url = "http://www.openstreetmap.org/api/0.3/$path";
+
open(my $TxFile, "<", $self->{file1});
open(my $RxFile, ">",$self->{file2});
$curl->setopt(CURLOPT_URL,$url);
@@ -91,20 +91,20 @@ sub upload(){
$curl->setopt(CURLOPT_INFILE,$TxFile);
$curl->setopt(CURLOPT_INFILESIZE, -s $self->{file1});
$curl->setopt(CURLOPT_FILE, $RxFile);
-
+
$curl->perform();
my $http_code = $curl->getinfo(CURLINFO_HTTP_CODE);
my $err = $curl->errbuf;
$curl->close();
close $TxFile;
close $RxFile;
-
+
open(my $ResponseFile, "<", $self->{file2});
my $response = int(<$ResponseFile>);
close $ResponseFile;
-
+
print "Code $http_code\n" if($http_code != 200);
-
+
return($response, $http_code);
}
diff --git a/navit/script/osm/Geo/OSM/Write.pm b/navit/script/osm/Geo/OSM/Write.pm
index 463c2d0cd..68c093b35 100644
--- a/navit/script/osm/Geo/OSM/Write.pm
+++ b/navit/script/osm/Geo/OSM/Write.pm
@@ -22,7 +22,7 @@ use Utils::Math;
# ------------------------------------------------------------------
sub tags2osm($){
my $obj = shift;
-
+
my $erg = "";
for my $k ( keys %{$obj->{tag}} ) {
my $v = $obj->{tag}{$k};
@@ -73,10 +73,10 @@ sub write_osm_file($$) { # Write an osm File
print $fh "<osm version=\'0.5\' generator=\'".$osm->{tool}."\'>\n";
if ( defined ( $osm->{bounds} ) ) {
my $bounds = $osm->{bounds};
- my $bounds_sting = "$bounds->{lat_min},$bounds->{lon_min},$bounds->{lat_max},$bounds->{lon_max}";
+ my $bounds_sting = "$bounds->{lat_min},$bounds->{lon_min},$bounds->{lat_max},$bounds->{lon_max}";
# -90,-180,90,180
print $fh " <bound box=\"$bounds_sting\" origin=\"OSM-perl-writer\" />\n";
-
+
}
# --- Nodes
@@ -90,9 +90,9 @@ sub write_osm_file($$) { # Write an osm File
next;
}
print $fh " <node id=\'$node_id\' ";
- print $fh " timestamp=\'".$node->{timestamp}."\' "
+ print $fh " timestamp=\'".$node->{timestamp}."\' "
if defined $node->{timestamp};
- print $fh " changeset=\'".$node->{changeset}."\' "
+ print $fh " changeset=\'".$node->{changeset}."\' "
if defined $node->{changeset};
print $fh " lat=\'$lat\' ";
print $fh " lon=\'$lon\' ";
@@ -109,10 +109,10 @@ sub write_osm_file($$) { # Write an osm File
next unless scalar( @{$way->{nd}} )>1;
print $fh " <way id=\'$way_id\'";
- print $fh " timestamp=\'".$way->{timestamp}."\'"
+ print $fh " timestamp=\'".$way->{timestamp}."\'"
if defined $way->{timestamp};
print $fh ">";
-
+
for my $way_nd ( @{$way->{nd}} ) {
next unless $way_nd;
print $fh " <nd ref=\'$way_nd\' />\n";
@@ -120,7 +120,7 @@ sub write_osm_file($$) { # Write an osm File
print $fh tags2osm($way);
print $fh " </way>\n";
$count_ways++;
-
+
}
print $fh "</osm>\n";