User talk:Tatata/ksj2osm-airport.pl

From OpenStreetMap Wiki
Jump to navigation Jump to search

ARP/ATB tag minor bug fix

ARP/ATBタグについて以下の不具合があります。地物のデータには問題ありません。

  • ksj:ARPタグに別の空港の座標が入る(例:成田→中標津)
  • ksj:ATBタグが空になる

GM_Pointのid比較を部分一致から完全一致に修正し、さらにhandle_end()内のエレメントクローズ条件を変更してみました。

@@ -98,7 +98,7 @@
 sub handle_char () {
 
   my ($expat, $string) = @_;
-#  $workString = $string;
+  $workString = $string;
   $workString .= "";                             # mod 2009-05-26
 }
 
@@ -123,9 +123,11 @@
     || $element eq "ksj:NPD"
     || $element eq "DirectPosition.coordinate") {get_element(@_);}
   elsif ($element eq "jps:TM_Instant") {add_time();}
-  elsif ($element eq "ksj:CF02") {add_airport();}
-  elsif ($element eq "ksj:ARP") {add_refpoint();}
-  elsif ($element eq "ksj:ATB") {add_terminal();}
+#  elsif ($element eq "ksj:CF02") {add_airport();}
+#  elsif ($element eq "ksj:ARP") {add_refpoint();}
+#  elsif ($element eq "ksj:ATB") {add_terminal();}
+  elsif ($element eq "ksj:CF03") {add_refpoint();}
+  elsif ($element eq "ksj:CF04") {add_terminal(); add_airport();}
   elsif ($element eq "ksj:RNW") {add_runway();}
   elsif ($element eq "ksj:CF05") {add_survey();}
   elsif ($element eq "jps:GM_Surface") {add_curve();}
@@ -466,11 +468,11 @@
     }
 
     if (exists($airportHash{$item}{"ARP"})) {
-      $airportHash{$item}{"ARP"} =~ s/$workHash{"id"}/$workHash{"points"}/g;
+      $airportHash{$item}{"ARP"} =~ s/^$workHash{"id"}$/$workHash{"points"}/g;
     }
 
     if (exists($airportHash{$item}{"ATB"})) {
-      $airportHash{$item}{"ATB"} =~ s/$workHash{"id"}/$workHash{"points"}/g;
+      $airportHash{$item}{"ATB"} =~ s/^$workHash{"id"}$/$workHash{"points"}/g;
     }

-- nori_u 16:45, 16 February 2010 (UTC)