JPGIS行政区域データのXMLを平成19年版にコンバートするスクリプト
@@ -0,0 +1,49 @@ | ||
1 | +#! /usr/bin/perl | |
2 | + | |
3 | +=pod | |
4 | + | |
5 | +=head1 NAME | |
6 | + | |
7 | +convert_administrative.pl - convert JPGIS administrative XML | |
8 | + | |
9 | +=head1 SYNOPSIS | |
10 | + | |
11 | + perl convert_administrative.pl N03-090320_27.xml > N03-090320_27_new.xml | |
12 | + | |
13 | +=cut | |
14 | + | |
15 | +use strict; | |
16 | +use warnings; | |
17 | + | |
18 | +my $f = 'top'; | |
19 | +my %x; | |
20 | + | |
21 | +while(<>){ | |
22 | + if(/<ksj:EC01/){ | |
23 | + $f = 'name'; | |
24 | + } | |
25 | + elsif (/<jps:GM_Surface/){ | |
26 | + $f = 'surface'; | |
27 | + } | |
28 | + elsif (/<jps:GM_OrientableCurve/){ | |
29 | + $f = 'oc'; | |
30 | + } | |
31 | + elsif (/<jps:GM_Curve/){ | |
32 | + $f = 'curve'; | |
33 | + } | |
34 | + elsif (/<jps:GM_Point/){ | |
35 | + $f = 'point'; | |
36 | + } | |
37 | + elsif (m@</ksj:OBJ>@){ | |
38 | + $f = 'bottom'; | |
39 | + } | |
40 | + | |
41 | + $x{$f} .= $_; | |
42 | +} | |
43 | +print $x{top}; | |
44 | +print $x{name}; | |
45 | +print $x{surface}; | |
46 | +print $x{oc}; | |
47 | +print $x{curve}; | |
48 | +print $x{point}; | |
49 | +print $x{bottom}; |