/docs/MyDocs

To get this branch, use:
bzr branch http://darksoft.org/webbzr/docs/MyDocs

« back to all changes in this revision

Viewing changes to Methods/Mapping/scripts/osm2mp/osmsort.pl

  • Committer: Suren A. Chilingaryan
  • Date: 2009-04-09 03:21:08 UTC
  • Revision ID: csa@dside.dyndns.org-20090409032108-w4edamdh4adrgdu3
import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
 
 
3
my $osm;
 
4
my %nod;
 
5
my %way;
 
6
my %rel;
 
7
 
 
8
my $obj;
 
9
 
 
10
while (<>) {
 
11
 
 
12
#    if ( /<osm/ )                       { $osm = "";     $obj = \$osm;}
 
13
    if ( /<node.*id=\"(\w*)\"/ )        { $nod{$1} = ""; $obj = \$nod{$1}; }
 
14
    if ( /<way.*id=\"(\w*)\"/ )         { $way{$1} = ""; $obj = \$way{$1}; }
 
15
    if ( /<relation.*id=\"(\w*)\"/ )    { $rel{$1} = ""; $obj = \$rel{$1}; }
 
16
    if ( /<\/?osm/ )                    { next; }
 
17
    if ( /<\?xml/ )                     { next; }
 
18
 
 
19
    ${$obj} .= $_;
 
20
}
 
21
 
 
22
print "<?xml version='1.0' standalone='yes'?>\n";
 
23
#print $osm;
 
24
print "<osm version=\"0.5\" generator=\"osmsort.pl\">\n";
 
25
print values %nod;
 
26
print values %way;
 
27
print values %rel;
 
28
print "</osm>\n";