[PostgreSQL] PostGIS: ์ค์น
PostGIS๋ PostgreSQL์ ํ์ฅ ์ค ํ๋๋ก, ๋ณต์กํ ์ขํ๊ธฐ๋ฐ์ ์ง๋ฆฌ์ ๊ณ์ฐ ๊ธฐ๋ฅ์ ์ ๊ณตํ๋ ์ง๋ฆฌ ์ ๋ณด ์์คํ (GIS:Geographic information system)์ด๋ค.
์คํ์์ค ์ง์์์๋ ์ด๊ฑธ ๋ฐ๋ผ์ค๋ GIS๊ฐ ๋ฑํ ์๋ ๊ฒ์ผ๋ก ์๊ณ ์๋ค.
์ค์นํ๊ธฐ (Windows)
์ด ๊ธฐ๋ฅ์ PostgreSQL ๊ธฐ๋ณธ ์คํ์๋ ํฌํจ๋์ด์์ง ์๋ค. ํ์ฅ ํ๋ก๊ทธ๋จ ํํ๋ก ์ค์นํด์ ์ฌ์ฉํด์ผ ํ๋ค.
Windows์ unix, linux ๊ณ์ด ๋ชจ๋ ์ง์์ด ๋๋ค.
Windows์ ๊ฒฝ์ฐ์๋, installer๋ก ์ค์นํ๋ค๋ฉด stackbuilder๋ผ๋ ํจํค์ง ๊ด๋ฆฌ์๊ฐ ์์ ๊ฒ์ด๋ค.
๊ทธ๊ฑธ ์คํํด์


PostGIS๋ฅผ ๊ณ ๋ฅด๊ณ
์ค์นํ๋ฉด ๋๋ค.
์ค์นํ๊ธฐ (Ubuntu)
์๋ ๋ช ๋ น์ผ๋ก ์ ์ฅ์์ postgis๋ฅผ ์ถ๊ฐํ๋ค.
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt xenial-pgdg main" >> /etc/apt/sources.list'
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt update

๊ทธ๋ฆฌ๊ณ ๋ฒ์ ์ ๋ง๋ postgis๋ฅผ ์ค์นํ๋ค.
๋ด ๊ฒฝ์ฐ์๋ postgres ๋ฒ์ ์ด 14์๋ค.
sudo apt install postgresql-14-postgis

ํ์ฅ ์ค์นํ๊ธฐ
postgis ํ์ผ์ ์ค์น๋ฐ์๋ค๋ฉด, ํด๋น ์ ๋ณด๋ค์ ๊ด๋ฆฌํ๊ธฐ ์ํ ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์คํค๋ง๋ฅผ ์ถ๊ฐํ๊ณ ์ฌ๊ธฐ์ create extention์ผ๋ก postgis ํ์ฅ์ ์ ์ ํด์ค๋ค.
CREATE DATABASE gisdb;
\connect gisdb;
CREATE SCHEMA postgis;
ALTER DATABASE gisdb SET search_path=public, postgis, contrib;
\connect gisdb;
CREATE EXTENSION postgis SCHEMA postgis;
SELECT postgis_full_version();

๊ทธ๋์ ์ค๋ฅ ์์ด ์ฒ๋ฆฌ๋๋ฉด ์ ๋ ๊ฒ์ด๋ค.
์ฐธ์กฐ
https://postgis.net/docs/manual-3.0/postgis-ko_KR.html
https://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS24UbuntuPGSQL10Apt
https://foss4g.tistory.com/1859