鈍足ランナーのIT日記

走るのが好きな5流のITエンジニアのブログ。

趣味の範囲は広いけど、どれも中途半端なクソブロガー楽しめるWebアプリを作ってあっと言わせたい。サーバーサイドPerl(Mojolicious)、クライアントサイドVue.js。Arduinoにも触手を伸ばす予定。

mac pgsql 使う

postgres.appのダウンロード

ダウンロードしたらアプリケーションフォルダへ格納する

postgresapp.com

.bash_profileの編集

ツールへのパスを通す

export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin

db作成

CentOSにPostgreSQL/PostGISの環境構築 | JURI★GIS

created test

psql -d test

test=# create extension Postgis;
CREATE EXTENSION
test=# select postgis_full_version();
                                                                           postgis_full_version                                                                           
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 POSTGIS="2.2.2 r14797" GEOS="3.5.0-CAPI-1.9.0 r4084" PROJ="Rel. 4.9.2, 08 September 2015" GDAL="GDAL 1.11.5, released 2016/07/01" LIBXML="2.9.4" LIBJSON="0.12.1" RASTER
(1 row)

¥q

ファイルに用意したSQLの実行

test=# ¥i test.sql

create table

create table hoge(
id int8 primary key,
address varchar(200),
geom geometry(point, 4326)
);

PostGISのよく使う機能をまとめた - Analyze IT.

insert文

load の仕方