Postgis Setup on Greenplum 6Postgis Setup on Greenplum 6
Spread the love

Introduction

This tutorial will cover how to install PostGIS on Ubuntu 18.04 Linux for Greenplum 6 clustered setup. Please repeat the compilation steps described below for each segment host of your Greenplum setup.

PostGIS is an open source PostgreSQL database extension for creating Geographic objects on the PostgreSQL object relational database.

Pre-Requisites for Compilation 

To compile geospatial form source code, please install the following third-party libraries as described in README.libs. For normal use without raster, please install json-c, geos and proj.4. To enable raster functionality, please install gdal and expat.

Installing Dependencies

$ sudo apt-get install autoconf

$ sudo apt-get install libgeos-3.7.1

$ geos-config –version

$ sudo apt-get update -y

$ sudo apt-get install -y libgeos-dev

$ sudo apt-get purge –remove libgeos-dev

If Yacc is missing ?

Use the synaptic packet manager in order to install yacc / lex. If you are feeling more comfortable doing this on the console just do:

$ sudo apt-get install bison flex

There are some very nice articles on the net on how to get started with those tools.

Installing GDAL

$ sudo apt install libgdal-dev

Readme for Installing Dependencies

Step 1

$ sudo apt-get install -y json-c-devel

$ sudo apt-get install -y geos-devel

$ sudo apt-get install -y proj-devel

$ sudo apt-get install -y expat
$ sudo apt-get install -y CUnit CUnit-devel

install gdal 1.11.1:
$ wget http://download.osgeo.org/gdal/1.11.1/gdal-1.11.1.tar.gz
$ tar zxf gdal-1.11.1.tar.gz
$ cd gdal-1.11.1
$ ./configure –prefix=$GPHOME (or other place you want, default is /usr/local)
$ make
$ make install

 

Clone the Git Repository

$ git clone https://github.com/greenplum-db/geospatial

Compilation and Installation

To compile and install geospatial in Greenplum 6 on Ubuntu 18.04 , use following command:

$ cd postgis/build/postgis-2.5.4/
$ ./autogen.sh
$ ./configure –with-pgconfig=$GPHOME/bin/pg_config –with-raster –without-topology –prefix=$GPHOME
$ make USE_PGXS=1 clean all install

Enabling Geospatial Extension in Greenplum 6

After installing geospatial extension, run the following commands to enable it:

$ psql mydatabase
mydatabase# CREATE EXTENSION postgis; — enables postgis and raster
mydatabase# CREATE EXTENSION fuzzystrmatch; — required for installing tiger geocoder
mydatabase# CREATE EXTENSION postgis_tiger_geocoder; — enables tiger geocoder
mydatabase# CREATE EXTENSION address_standardizer; — enable address_standardizer
mydatabase# CREATE EXTENSION address_standardizer_data_us;

References

https://greenplum.org/install-greenplum-oss-on-ubuntu/

 

https://github.com/greenplum-db/geospatial/blob/master/postgis/README.libs

 

 

By Hassan Amin

Dr. Syed Hassan Amin has done Ph.D. in Computer Science from Imperial College London, United Kingdom and MS in Computer System Engineering from GIKI, Pakistan. During PhD, he has worked on Image Processing, Computer Vision, and Machine Learning. He has done research and development in many areas including Urdu and local language Optical Character Recognition, Retail Analysis, Affiliate Marketing, Fraud Prediction, 3D reconstruction of face images from 2D images, and Retinal Image analysis in addition to other areas.