shp2pgsql と psql コマンドを使ってシェイプファイルをデータベースに登録します。
user@debian7-vmw:~/mapdata/nlni/public_facilities/iwate$ cd ../../mapdata
user@debian7-vmw:~/mapdata$ ogrinfo rikuzentakata
INFO: Open of `rikuzentakata'
using driver `ESRI Shapefile' successful.
1: 03210-20120327-RailCL (Line String)
2: 03210-20120327-WF (Line String)
3: 03210-20120327-WStrL (Line String)
4: 03210-20120327-WStrA (Polygon)
5: 03210-20120327-BldA (Polygon)
6: 03210-20120327-CommBdry (Line String)
7: 03210-20120327-AdmBdry (Line String)
8: 03210-20120327-WA (Polygon)
9: 03210-20120327-RdEdg (Line String)
10: 03210-20120327-BldL (Line String)
11: 03210-20120327-RdCompt (Line String)
12: 03210-20120327-WL (Line String)
user@debian7-vmw:~/mapdata$ ogrinfo -summary rikuzentakata 03210-20120327-AdmBdry
INFO: Open of `rikuzentakata'
using driver `ESRI Shapefile' successful.
Layer name: 03210-20120327-AdmBdry
Geometry: Line String
Feature Count: 634
Extent: (55999.999987, -117971.370007) - (77583.909965, -98138.759978)
Layer SRS WKT:
PROJCS["JGD2000_Japan_Zone_10",
GEOGCS["GCS_JGD_2000",
DATUM["Japanese_Geodetic_Datum_2000",
SPHEROID["GRS_1980",6378137.0,298.257222101]],
PRIMEM["Greenwich",0.0],
UNIT["Degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"],
PARAMETER["False_Easting",0.0],
PARAMETER["False_Northing",0.0],
PARAMETER["Central_Meridian",140.833333333333],
PARAMETER["Scale_Factor",0.9999],
PARAMETER["Latitude_Of_Origin",40],
UNIT["Meter",1.0]]
ID: String (7.0)
UUID: String (29.0)
PRESENCES: Real (11.2)
PRESENCEF: Real (11.2)
FINISHED: Real (11.2)
ORGGILVL: String (4.0)
ORGMDID: String (6.0)
CATEGORY: String (4.0)
FLAG: String (4.0)
TYPE: String (18.0)
shp2pgsql と psql コマンドを使ってシェイプファイルをデータベースに登録します。
user@debian7-vmw:~/mapdata$ cd rikuzentakata/
user@debian7-vmw:~/mapdata/rikuzentakata$ ls
03210-20120327-AdmBdry.dbf 03210-20120327-RdEdg.dbf
03210-20120327-AdmBdry.prj 03210-20120327-RdEdg.prj
03210-20120327-AdmBdry.shp 03210-20120327-RdEdg.shp
03210-20120327-AdmBdry.shx 03210-20120327-RdEdg.shx
03210-20120327-BldA.dbf 03210-20120327-WA.dbf
03210-20120327-BldA.prj 03210-20120327-WA.prj
03210-20120327-BldA.shp 03210-20120327-WA.shp
03210-20120327-BldA.shx 03210-20120327-WA.shx
03210-20120327-BldL.dbf 03210-20120327-WF.dbf
03210-20120327-BldL.prj 03210-20120327-WF.prj
03210-20120327-BldL.shp 03210-20120327-WF.shp
03210-20120327-BldL.shx 03210-20120327-WF.shx
03210-20120327-CommBdry.dbf 03210-20120327-WL.dbf
03210-20120327-CommBdry.prj 03210-20120327-WL.prj
03210-20120327-CommBdry.shp 03210-20120327-WL.shp
03210-20120327-CommBdry.shx 03210-20120327-WL.shx
03210-20120327-RailCL.dbf 03210-20120327-WStrA.dbf
03210-20120327-RailCL.prj 03210-20120327-WStrA.prj
03210-20120327-RailCL.shp 03210-20120327-WStrA.shp
03210-20120327-RailCL.shx 03210-20120327-WStrA.shx
03210-20120327-RdCompt.dbf 03210-20120327-WStrL.dbf
03210-20120327-RdCompt.prj 03210-20120327-WStrL.prj
03210-20120327-RdCompt.shp 03210-20120327-WStrL.shp
03210-20120327-RdCompt.shx 03210-20120327-WStrL.shx
user@debian7-vmw:~/mapdata/rikuzentakata$ shp2pgsql -W sjis 03210-20120327-AdmBdry.shp rikuzentakata_kukakusen > rikuzentakata_kukakusen.sql
Shapefile type: Arc
Postgis type: MULTILINESTRING[2]
user@debian7-vmw:~/mapdata/rikuzentakata$ shp2pgsql -W sjis 03210-20120327-BldA.shp rikuzentakata_kenchiku > rikuzentakata_kenchiku.sql
Shapefile type: Polygon
Postgis type: MULTIPOLYGON[2]
user@debian7-vmw:~/mapdata/rikuzentakata$ psql -d nippon_bmi -f rikuzentakata_kukakusen.sql
user@debian7-vmw:~/mapdata/rikuzentakata$ psql -d nippon_bmi -f rikuzentakata_kenchiku.sql
user@debian7-vmw:~/mapdata/rikuzentakata$ psql nippon_bmi
psql (9.1.11)
"help" でヘルプを表示します.
nippon_bmi=> \dt
リレーションの一覧 スキーマ | 名前 | 型 | 所有者 ----------+-------------------------+----------+-------- --- public | rikuzentakata_kenchiku | テーブル | user public | rikuzentakata_kukakusen | テーブル | user --- (24 行) (END):q
他のデータもデータベースに登録します。
user@debian7-vmw:~/mapdata/rikuzentakata$ shp2pgsql -W sjis 03210-20120327-CommBdry.shp rikuzentakata_choaza > rikuzentaka_choaza.sql
Shapefile type: Arc
Postgis type: MULTILINESTRING[2]
user@debian7-vmw:~/mapdata/rikuzentakata$ shp2pgsql -W sjis 03210-20120327-RailCL.shp rikuzentakata_kido > rikuzentaka_kido.sql
Shapefile type: Arc
Postgis type: MULTILINESTRING[2]
user@debian7-vmw:~/mapdata/rikuzentakata$ shp2pgsql -W sjis 03210-20120327-RdCompt.shp rikuzentakata_dorokozo > rikuzentaka_dorokozo.sql
Shapefile type: Arc
Postgis type: MULTILINESTRING[2]
user@debian7-vmw:~/mapdata/rikuzentakata$ shp2pgsql -W sjis 03210-20120327-RdEdg.shp rikuzentakata_doro > rikuzentaka_doro.sql
Shapefile type: Arc
Postgis type: MULTILINESTRING[2]
user@debian7-vmw:~/mapdata/rikuzentakata$ shp2pgsql -W sjis 03210-20120327-WA.shp rikuzentakata_suiiki > rikuzentaka_suiiki.sql
Shapefile type: Polygon
Postgis type: MULTIPOLYGON[2]
user@debian7-vmw:~/mapdata/rikuzentakata$ shp2pgsql -W sjis 03210-20120327-WF.shp rikuzentakata_kaigan > rikuzentaka_kaigan.sql
Shapefile type: Arc
Postgis type: MULTILINESTRING[2]
user@debian7-vmw:~/mapdata/rikuzentakata$ shp2pgsql -W sjis 03210-20120327-WL.shp rikuzentakata_suigai > rikuzentaka_suigai.sql
Shapefile type: Arc
Postgis type: MULTILINESTRING[2]
user@debian7-vmw:~/mapdata/rikuzentakata$ shp2pgsql -W sjis 03210-20120327-WStrA.shp rikuzentakata_suikozo > rikuzentaka_suikozo.sql
Shapefile type: Polygon
Postgis type: MULTIPOLYGON[2]
user@debian7-vmw:~/mapdata/rikuzentakata$ shp2pgsql -W sjis 03210-20120327-WStrL.shp rikuzentakata_suikozosen > rikuzentaka_suikozosen.sql
Shapefile type: Arc
Postgis type: MULTILINESTRING[2]
user@debian7-vmw:~/mapdata/rikuzentakata$ psql -d nippon_bmi -f rikuzentaka_choaza.sql
user@debian7-vmw:~/mapdata/rikuzentakata$ psql -d nippon_bmi -f rikuzentaka_kido.sql
user@debian7-vmw:~/mapdata/rikuzentakata$ psql -d nippon_bmi -f rikuzentaka_dorokozo.sql
user@debian7-vmw:~/mapdata/rikuzentakata$ psql -d nippon_bmi -f rikuzentaka_doro.sql
user@debian7-vmw:~/mapdata/rikuzentakata$ psql -d nippon_bmi -f rikuzentaka_suiiki.sql
user@debian7-vmw:~/mapdata/rikuzentakata$ psql -d nippon_bmi -f rikuzentaka_kaigan.sql
user@debian7-vmw:~/mapdata/rikuzentakata$ psql -d nippon_bmi -f rikuzentaka_suigai.sql
user@debian7-vmw:~/mapdata/rikuzentakata$ psql -d nippon_bmi -f rikuzentaka_suikozo.sql
user@debian7-vmw:~/mapdata/rikuzentakata$ psql -d nippon_bmi -f rikuzentaka_suikozosen.sql
0 件のコメント:
コメントを投稿