一般ユーザでシェイプファイルのあるディレクトリに移動して、次のように入力します。
user@debian:~$ cd download/pf_tokyo_shp/
user@debian:~/download/pf_tokyo_shp$ shp2pgsql -W sjis P02-06_13_FB01.shp pf_tokyo > pf_tokyo.sql
Shapefile type: Point
Postgis type: POINT[2]
user@debian:~/download/pf_tokyo_shp$ psql -d tokyo -f pf_tokyo.sql
user@debian:~/download/pf_tokyo_shp$ psql tokyo
Welcome to psql 8.3.7, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
tokyo=> \dt
List of relations
Schema | Name | Type | Owner
--------+------------------+-------+-------
public | geometry_columns | table | user
public | gyoseikai | table | user
public | pf_tokyo | table | user
public | population | table | user
public | spatial_ref_sys | table | user
(5 rows)
pf_tokyoテーブル内のカラムとその他の一覧を表示してみます。
tokyo=> \d pf_tokyo
Table "public.pf_tokyo"
Column | Type | Modifiers
----------+-----------------------+--------------------------------------------------------
gid | integer | not null default nextval('pf_tokyo_gid_seq'::regclass)
aac | character varying(5) |
ren | character varying(1) |
com | character varying(1) |
cls | character varying(1) |
pca | character varying(2) |
pci | character varying(5) |
na8 | character varying(1) |
na0 | character varying(82) |
ads | character varying(63) |
apf | character varying(1) |
ad6 | character varying(1) |
ys3 | character varying(1) |
oy2 | character varying(1) |
rcn | character varying(12) |
the_geom | geometry |
Indexes:
"pf_tokyo_pkey" PRIMARY KEY, btree (gid)
Check constraints:
"enforce_dims_the_geom" CHECK (ndims(the_geom) = 2)
"enforce_geotype_the_geom" CHECK (geometrytype(the_geom) = 'POINT'::text OR the_geom IS NULL)
"enforce_srid_the_geom" CHECK (srid(the_geom) = (-1))
tokyo=> \q
0 件のコメント:
コメントを投稿