-
Notifications
You must be signed in to change notification settings - Fork 13
Postgis
PostGIS is a spatial database extension for PostgreSQL, a Database Management System (DBMS). TerraME allows working with PostGIS databases easily. This page describes how to install the PostGIS that is currently used for the automatic tests. Other installations might work but were not tested.
If you have another installation of PostgreSQL you can remove it using the steps described here.
First you need to install Homebrew. Open a terminal and execute:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
The command above also installs Xcode.
Still in the terminal, execute the following commands to install PostgreSQL and PostGIS:
brew install postgresql
brew link postgresql
brew install postgis
Add a new user to manage the service to be started. You will be asked for a password.
createuser -s postgres -P
Start PostgreSQL as a service:
brew services start postgresql
1- Download the install for your specific platform from the PostgreSQL Binary Download ( http://www.postgresql.org/download/). The minimum support PostgreSQL for PostGIS 2.2.0 is PostgreSQL 9.1 (for windows we only build installers for 9.3-9.5 for the 2.2.0 series);
2- Launch exe to install PostgreSQL;
3- Once PostgreSQL is installed, launch Application Stack Builder from (Start->Programs->PostgreSQL 9.x->Applciation Stackbuilder), and pick the version of PostgreSQL you want to install PostGIS on;
4- Select the version of PostGIS to install;
5- Navigate to spatial extensions and pick PostGIS 2.x. Download and Install;
6- Choose 'yes' to register the GDAL_DATA enviroment variable, enable raster drivers and enable out of database rasters. This is because in order to do operations that require raster transformations or other rater warping / clipping etc, PostGIS uses GDAL epsg files;
7- Launch pgAdmin GUI (Start->Programs->PostgreSQL 9.x->PgAdmin III). If the Plugins green is disabled (and says No Plugins installed) then most likely you have another PgAdmin or PostgreSQL install getting in the way. An easy fix is to open up PgAdmin III go under File->Options and make sure your PG bin path is pointing at the locations of your PostgreSQL bin (e.g. C:\Program Files\PostgreSQL\9.x\bin).
8- Creating a spatial database using SQL
You can use pgAdmin query window to create a spatial database. For example:
CREATE DATABASE gisdb;
\connect gisdb;
-- Enable PostGIS (includes raster)
CREATE EXTENSION postgis;
-- Enable Topology
CREATE EXTENSION postgis_topology;
-- Enable PostGIS Advanced 3D
-- and other geoprocessing algorithms
CREATE EXTENSION postgis_sfcgal;
-- fuzzy matching needed for Tiger
CREATE EXTENSION fuzzystrmatch;
-- rule based standardizer
CREATE EXTENSION address_standardizer;
-- example rule data set
CREATE EXTENSION address_standardizer_data_us;
-- Enable US Tiger Geocoder
CREATE EXTENSION postgis_tiger_geocoder;
-- routing functionality
CREATE EXTENSION pgrouting;
-- spatial foreign data wrappers
CREATE EXTENSION ogr_fdw;
-- LIDAR support
CREATE EXTENSION pointcloud;
-- LIDAR Point cloud patches to geometry type cases
CREATE EXTENSION pointcloud_postgis;
http://www.bostongis.com/PrinterFriendly.aspx?content_name=postgis_tut01
If you have comments, doubts or suggestions related to this document, please write a feedback to pedro.andrade <at> inpe.br.
Back to wiki or terrame.org.