User talk:Tatata

From OpenStreetMap Wiki
Jump to: navigation, search

OpenRailMap

Thank you for your interest!

The table you refer to has been moved to a UK sub-page but you are welcome to re-format it and tidy it up, in it's new location..


On the subject of railways in Japan, One possible source of information might be Hisakyu's one (http://wiki.openstreetmap.org/index.php/User:ShakespeareFan00/OpenRailMap). This is assuming that the maintainer of that site can be contacted, and an OSM compatible license can be agreed upon. ShakespeareFan00 23:54, 11 April 2008 (BST)

ksj2osm

1

Hi,

I'm trying to help with the MLIT data import. I git the script, the data, then I try to make a conversion:

   ***** KSJ2 Airport Data 2007 : Start Sun Sep  7 03:15:45 2008
   ***** Target : 大阪国際空港, airport type = 1
   ***** Process of infile : End Sun Sep  7 03:15:47 2008
   Use of uninitialized value in printf at ksj2osm-airport.pl line 498.
   Use of uninitialized value in printf at ksj2osm-airport.pl line 498.
   Use of uninitialized value in printf at ksj2osm-airport.pl line 501.
   Use of uninitialized value in printf at ksj2osm-airport.pl line 504.
   Use of uninitialized value in printf at ksj2osm-airport.pl line 504.
   ***** Airports : 0 nodes on 0 ways
   Use of uninitialized value in printf at ksj2osm-airport.pl line 507.
   ***** Airports : 0 nodes tagged as "aeroway=aerodrome"
   ***** Done!: End Sun Sep  7 03:15:47 2008

My OS is Linux, utf8 locale. I'm wondering why no point is grabbed from the xml file. Any hint? Nilx 01:27, 7 September 2008 (UTC)

2

Hi Nilx, I downloaded the data file today and run the script again on my pc (Win XP), but it ended with no error.

 C:\OpenStreetMap\JPGIS\data\Airport\test20080907 のディレクトリ

2008/09/07  19:07    <DIR>          .
2008/09/07  19:07    <DIR>          ..
2008/02/05  16:31         2,487,746 C28-07.xml
2008/09/07  19:05            98,661 C28-07.zip
2008/04/12  08:15            29,414 ksj2osm-airport.pl
               3 個のファイル           2,615,821 バイト
               2 個のディレクトリ  13,490,339,840 バイトの空き領域

C:\OpenStreetMap\JPGIS\data\Airport\test20080907>perl ksj2osm-airport.pl
***** KSJ2 Airport Data 2007 : Start Sun Sep  7 19:09:15 2008
***** Target : 大阪国際空港, airport type = 0
***** Process of infile : End Sun Sep  7 19:09:23 2008
***** Airports : 100 nodes on 2 ways
***** Airports : 2 nodes tagged as "aeroway=aerodrome"
***** Done!: End Sun Sep  7 19:09:23 2008 

C:\OpenStreetMap\JPGIS\data\Airport\test20080907>

Sorry, I have never run the script on Linux, so I have no idea at this time. I'll try to run it tomorrow on my another pc (Win XP + VMware + Ubuntu). -- Tatata 10:27, 7 September 2008 (UTC)

3

Thanks for your answer. More details here:

nil@senbei ~/tmp/osm-jp
$ ls
C28-04.zip  C28-07.xml  C28-07.zip  ksj2osm-airport.pl
nil@senbei ~/tmp/osm-jp
$ head ksj2osm-airport.pl 

#!/usr/bin/perl

use strict;
use warnings;
#use encoding "utf8", STDOUT => "shiftjis", STDERR => "shiftjis"; # for Windows
use Encode;
use open IO => "utf8";
use XML::Parser;
use XML::Simple;
nil@senbei ~/tmp/osm-jp
$ perl ksj2osm-airport.pl 
***** KSJ2 Airport Data 2007 : Start Sun Sep  7 16:39:25 2008
***** Target : 大阪国際空港, airport type = 0
***** Process of infile : End Sun Sep  7 16:39:27 2008
Use of uninitialized value in printf at ksj2osm-airport.pl line 497.
Use of uninitialized value in printf at ksj2osm-airport.pl line 497.
Use of uninitialized value in printf at ksj2osm-airport.pl line 500.
Use of uninitialized value in printf at ksj2osm-airport.pl line 503.
Use of uninitialized value in printf at ksj2osm-airport.pl line 503.
***** Airports : 0 nodes on 0 ways
Use of uninitialized value in printf at ksj2osm-airport.pl line 506.
***** Airports : 0 nodes tagged as "aeroway=aerodrome"
***** Done!: End Sun Sep  7 16:39:27 2008
nil@senbei ~/tmp/osm-jp
$ perl -v

This is perl, v5.8.8 built for i486-linux-gnu-thread-multi 

Copyright 1987-2006, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

I commmented out the following line

use encoding "utf8", STDOUT => "shiftjis", STDERR => "shiftjis"; # for Windows

...because it triggered this error message (文字化け included)

nil@senbei ~/tmp/osm-jp
$ perl ksj2osm-airport.pl 
***** KSJ2 Airport Data 2007 : Start Sun Sep  7 16:44:24 2008
***** Target : ���㍑�ۋ��`, airport type = 0
Cannot decode string with wide characters at /usr/lib/perl/5.8/Encode.pm line 166.

Nilx 14:48, 7 September 2008 (UTC)

4

Thank you for details. I asked to talk-ja mailing list about running the script on Linux. Then I got reply that one person is using railway data script on Fedora8/9, CentOS5.2 (Perl: 5.8.8, 5.8.10). talk-ja(written in Japanese)

Can you try the following; change that line from

use encoding "utf8", STDOUT => "shiftjis", STDERR => "shiftjis"; # for Windows

to

use encoding "utf8";

-- Tatata 15:51, 7 September 2008 (UTC)

5

Removing the STDOUT/STDERR part makes this result;

nil@senbei ~/tmp/osm-jp
$ perl ksj2osm-airport.pl 
***** KSJ2 Airport Data 2007 : Start Sun Sep  7 18:08:24 2008
***** Target : 大阪国際空港, airport type = 0
Cannot decode string with wide characters at /usr/lib/perl/5.8/Encode.pm line 166.

I'll try to ask to people around me also. Thanks. Nilx 16:10, 7 September 2008 (UTC)

6

I ran the script on my another pc today and got other error because of missing a perl module, but unfortunately the same error above did not come up. The copies of my screen are here; User:Tatata/ksj2osm-airport.pl/running on linux. If there are some commands to check my linux/perl environment, please let me know. I'll do it tomorrow. -- Tatata 07:40, 8 September 2008 (UTC)

7

Could you:

  • tell me what the "locale" command tells you on your linux machine?
  • make the perl script available as a gzipped (or simply zipped) file, to ensure I have it with the same encoding as you?

Thanks. Nilx 10:58, 8 September 2008 (UTC)

I could track the problem. It seems to come from these lines, in get_codelist():

$aac_code = XMLin($xml_aac, keyattr => ["code"]);
$pref_code = XMLin($xml_pref, keyattr => ["code"]);

Commenting out these lines make the script work, but I guess some information is missing.

Nilx 11:46, 8 September 2008 (UTC)

8

Wow, nice tracking.

$aac_code is a reference to a hash of municipality code and municipality name in Japanese. $pref_code is a reference to a hash of prefecture code and prefecture name in Japanese. These are used in WAY tag as meta data of KSJ2, so you can leave them out since they are not important.

By the way, according to this page, "XMLin()" is a subroutine of "XML::Simple". Though I'm not sure whether the version of the perl module is related to the problem, I installed XML-Simple-2.18 through CPAN today; this is just a info.

Here are my locale and a gzipped file, maybe they are no longer needed. -- Tatata 15:46, 8 September 2008 (UTC)