Skip to content

Instantly share code, notes, and snippets.

@oojikoo-gist
Created July 28, 2015 06:32
Show Gist options
  • Save oojikoo-gist/6947349af49345059830 to your computer and use it in GitHub Desktop.
Save oojikoo-gist/6947349af49345059830 to your computer and use it in GitHub Desktop.
mac: install_postgis_osx
# 현재 가장 잘 동작하는 버전인듯
# postgres는 설치했다고 가정하자.
# Some good references are:
# http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x
# http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/
# http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392
# 환경변수에 LC_COLLATE=C 이거 있는지 확인
#1. Install PostGIS
brew install postgis
#2. Create a template to be used on creating GIS-enabled databases
createdb template_postgis2
createlang plpgsql template_postgis2
#[Mac OSX] Import Postgis Data
psql -d template_postgis2 -f /usr/local/Cellar/postgis/2.0.2/share/postgis/postgis.sql
psql -d template_postgis2 -f /usr/local/Cellar/postgis/2.0.2/share/postgis/spatial_ref_sys.sql
# If you want Raster support
psql -d template_postgis2 -f /usr/local/Cellar/postgis/2.0.2/share/postgis/rtpostgis.sql
psql -d template_postgis2 -f /usr/local/Cellar/postgis/2.0.2/share/postgis/topology.sql
psql -d template_postgis2 -c "GRANT ALL ON geometry_columns TO PUBLIC;"
psql -d template_postgis2 -c "GRANT ALL ON geography_columns TO PUBLIC;"
psql -d template_postgis2 -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"
createdb training -T template_postgis2
#Test if works
psql -d template_postgis2 -c "SELECT postgis_full_version();"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment