-> Its helpful to collect all objects into a single package is called extension.
Eg: If a new data type will require new functions,new operators and new index operator classes all this will be kept in single package to
simplify database management.
1.Since postgresql is a open source database management system we can add our own data types based on our requirement.
For this we need a script file and control file.
Syntax:
create extension postgis;
-> without installing these if we try to create the extension then it will throw error.
Note: Before adding this extension we need to configure the binaries for the corresponding extension. Follow the steps below.
Postgis installation:
-> Before installing postgis we need to install the files in the sequence.
Install and/or build GEOS, Proj.4, GDAL, LibXML2
Step1:
GEOS
tar -xvf geos-3.5.1.tar.gz
cd geos-3.5.1
./configure
make
make install
-> After installing to know the installation directory
locate geos-config
Step2:
proj-4.8.0
tar -xvf proj-4.8.0.tar.gz
cd proj-4.8.0
./configure
make
make install
Step3:
gdal-2.1.3
tar -xvf gdal-2.1.3.tar.gz
cd gdal-2.1.3
./configure
make
make install
Step4:
postgis-2.2.5
tar -xvf postgis-2.2.5.tar.gz
cd gdal-2.1.3
./configure
or
./configure –with-pgconfig=/usr/local/pgsql/bin/pg_config
–with-xml2config=/usr/bin/xml2-config
–with-projdir=/usr/share/doc/proj-4.8.0/
–with-gdalconfig=/usr/local/bin/gdal-configlocate xml2-config
make
make install
-> To see any files missing use the below cmd
ldd /usr/local/pgsql/lib/rtpostgis-2.2.so