Contents
同じ空間参照系シェープファイルの準備、インポート
忙しくてogr2ogr
使うデータは、前回までと同じ総務省統計局「地図で見る統計(統計
ZIP
インポートコマンドは10
$ cd D:\AppsPortable\GDAL\release-1500-gdal-1-11-1-mapserver-6-4-1\bin $ gdal\apps\ogr2ogr -progress -f "MySQL" MySQL:estat,user=root,password=******** R:\estat\XYSJC_h22ka01102.shp # just one line actually $ gdal\apps\ogr2ogr -progress -f "MySQL" MySQL:estat,user=root,password=******** R:\estat\XYSWC_h22ka01102.shp $ gdal\apps\ogr2ogr -progress -f "MySQL" MySQL:estat,user=root,password=******** R:\estat\DDSJC_h22ka01102.shp $ gdal\apps\ogr2ogr -progress -f "MySQL" MySQL:estat,user=root,password=******** R:\estat\DDSWC_h22ka01102.shp
結果:同じ空間参照系には同じ SRID が付いてた
まずテーブル一覧を見ると ↓ 確かにmysql> show tables;
テーブル
SELECT F_TABLE_NAME, F_GEOMETRY_COLUMN, SRID, TYPE FROM geometry_columns; +------------------+-------------------+------+---------+ | F_TABLE_NAME | F_GEOMETRY_COLUMN | SRID | TYPE | +------------------+-------------------+------+---------+ | xysjc_h22ka01101 | SHAPE | 1 | POLYGON | | xyswc_h22ka01101 | SHAPE | 2 | POLYGON | | ddsjc_h22ka01101 | SHAPE | 3 | POLYGON | | ddswc_h22ka01101 | SHAPE | 4 | POLYGON | | xysjc_h22ka01102 | SHAPE | 1 | POLYGON | | xyswc_h22ka01102 | SHAPE | 2 | POLYGON | | ddsjc_h22ka01102 | SHAPE | 3 | POLYGON | | ddswc_h22ka01102 | SHAPE | 4 | POLYGON | +------------------+-------------------+------+---------+ 8 rows in set (0.00 sec) SELECT SRID, AUTH_NAME, AUTH_SRID, LEFT(SRTEXT, 35) FROM spatial_ref_sys; +------+-----------+-----------+-------------------------------------+ | SRID | AUTH_NAME | AUTH_SRID | LEFT(SRTEXT, 35) | +------+-----------+-----------+-------------------------------------+ | 1 | NULL | NULL | PROJCS["Japan_Zone_12",GEOGCS["GCS_ | | 2 | NULL | NULL | PROJCS["JGD_2000_Japan_Zone_12",GEO | | 3 | NULL | NULL | GEOGCS["GCS_Tokyo",DATUM["Tokyo",SP | | 4 | NULL | NULL | GEOGCS["GCS_JGD_2000",DATUM["JGD_20 | +------+-----------+-----------+-------------------------------------+ 4 rows in set (0.00 sec)
補足:ogr2ogr による SRID 設定について
下記によれば、ogr2ogrWhen OGR guesses wrong or fails to guess
(...)
Sometimes OGR can't match the projection to one in your spatial_ref_sys table so creates a new entry in that table. In these cases you have to tell OGR what the output projection is. You do this with the -a_srs flag.
ということは、今回追加インポートしたデータに既存の