Skip to content

Instantly share code, notes, and snippets.

@sahara-ooga
Last active May 21, 2020 05:58
Show Gist options
  • Save sahara-ooga/0e93396a63b47e02bc01f53ae25081bd to your computer and use it in GitHub Desktop.
Save sahara-ooga/0e93396a63b47e02bc01f53ae25081bd to your computer and use it in GitHub Desktop.
PostgreSQLでGeoTiffをインポートするまで

install postgreSQL and PostGIS

$ brew install postgresql

$ brew install postgis

Enable PostGIS and Raster extension

execute SQL statement for each database.

$ psql -d pythonspatial -c "CREATE EXTENSION postgis;"
CREATE EXTENSION
$ psql -d pythonspatial -c "CREATE EXTENSION postgis_raster;"
CREATE EXTENSIO

Import GeoTiff

$ raster2pgsql -I -C -s 4612 tif/523764*.tif public.bigi | psql -h localhost -p 5432 -U user -d pythonspatial
Processing 1/1: tif/523764-A.tif
BEGIN
CREATE TABLE
INSERT 0 1
CREATE INDEX
ANALYZE
NOTICE:  Adding SRID constraint
NOTICE:  Adding scale-X constraint
NOTICE:  Adding scale-Y constraint
NOTICE:  Adding blocksize-X constraint
NOTICE:  Adding blocksize-Y constraint
NOTICE:  Adding alignment constraint
NOTICE:  Adding number of bands constraint
NOTICE:  Adding pixel type constraint
NOTICE:  Adding nodata value constraint
NOTICE:  Adding out-of-database constraint
NOTICE:  Adding maximum extent constraint
 addrasterconstraints 
----------------------
 t
(1 row)

COMMIT

That's all.

Reference

PostGIS — Installation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment