当前位置:网站首页>MacBook installation postgresql+postgis

MacBook installation postgresql+postgis

2022-07-05 04:09:00 Sun batian

MacBook install postgreSQL+postgis

Recently started using macbook Pro, Make a special note of mac Under the postgreSQL setup script

install PostgreSQL

Use brew install

brew install postgres

image-20220626143334443

start-up postgres

 brew services restart postgresql
 # or
 /opt/homebrew/opt/postgresql/bin/postgres -D /opt/homebrew/var/postgres

Check the status

pg_ctl -D /opt/homebrew/var/postgres -l /opt/homebrew/var/postgres/server.log status

see

pg_ctl -D /opt/homebrew/var/postgres -l /opt/homebrew/var/postgres/server.log stop -s -m fast

Create user

createuser postgres -P

install PostGIS

brew install postgis

image-20220626150638341

Create database

createdb test
createdb test -O username -E UTF8 -e

Connect to database

psql test

establish postgis plug-in unit

CREATE EXTENSION postgis;

image-20220626150958073

SELECT PostGIS_Version();

image-20220626151036729

Import tiff image

Data needs to be installed first postgis and postgis_raster plug-in unit

windows Next use

Get into postgresql Of bin Catalog

C:\Program Files\PostgreSQL\12\bin

Direct write postgresql

raster2pgsql -s 4326 -C D:\data\20211008data\hulan\new\2020_hulan_corn_yield.tif -F -t 256x256 public.2020_hulan_corn_yield | psql -h localhost -p 5432 -U postgres -d raster -W

Mr Into sql, Reuse psql Import database

raster2pgsql -s 4326 -I -M -C D:\data\20211008data\jingxian\2020_jx_wheat_yield.tif -F -t 256x256 public.2020_jx_wheat_yield > D:\2020_jx_wheat_yield.sql

psql -d raster -U postgres -f D:\2020_jx_wheat_yield.sql
原网站

版权声明
本文为[Sun batian]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207050405021759.html