PostGIS (imagen destacada)

Tiro monedas al aire, pero hasta ahora nunca las pude agarrar.

PostGIS
PostGIS

Para tener PostGIS 2.3.0 en Debian Jessie hacemos lo siguiente.

OBS:

  • Se usa Debian Jessie de 64 bits.
  • Asumo que tienen instalado PostgreSQL 9.6

Entramos a la consola y escribimos:
sudo apt-get update && sudo apt-get install build-essential libxml2-dev libproj-dev libjson0-dev libgeos-dev xsltproc docbook-xsl docbook-mathml libgdal-dev postgresql-9.6-postgis-2.3 postgresql-9.6-postgis-scripts postgresql-server-dev-9.6 -y

Volvemos a entrar a la consola y escribimos:
cd ~ && wget -c http://download.osgeo.org/postgis/source/postgis-2.3.0.tar.gz && tar xfvz postgis-2.3.0.tar.gz && cd postgis-2.3.0/ && ./configure --with-raster --with-topology --with-gui

Saldría por pantalla lo siguiente:
PostGIS is now configured for x86_64-pc-linux-gnu

-------------- Compiler Info -------------
C compiler:           gcc -g -O2
SQL preprocessor:     /usr/bin/cpp -traditional-cpp -w -P

-------------- Dependencies --------------
GEOS config:          /usr/bin/geos-config
GEOS version:         3.4.2
GDAL config:          /usr/bin/gdal-config
GDAL version:         1.10.1
PostgreSQL config:    /usr/bin/pg_config
PostgreSQL version:   PostgreSQL 9.6.0
PROJ4 version:        48
Libxml2 config:       /usr/bin/xml2-config
Libxml2 version:      2.9.1
JSON-C support:       yes
PCRE support:         yes
PostGIS debug level:  0
Perl:                 /usr/bin/perl

--------------- Extensions ---------------
PostGIS Raster:       enabled
PostGIS Topology:     enabled
SFCGAL support:       disabled
Address Standardizer support:       enabled

-------- Documentation Generation --------
xsltproc:             /usr/bin/xsltproc
xsl style sheets:     /usr/share/xml/docbook/stylesheet/nwalsh
dblatex:
convert:
mathml2.dtd:          /usr/share/xml/schema/w3c/mathml/dtd/mathml2.dtd

configure: WARNING:  --------- GEOS VERSION WARNING ------------
configure: WARNING:   You are building against GEOS 3.4.2
configure: WARNING:   To take advantage of all the features of
configure: WARNING:   PostGIS we recommend you build using
configure: WARNING:   GEOS 3.5.0 or higher. You can download
configure: WARNING:   the latest versions from
configure: WARNING:   http://trac.osgeo.org/geos
configure: WARNING:

Obs:

  • PostGIS 2.3.0 recomienda tener GEOS 3.5.0 para tener todas la nuevas funcionalidades de PostGIS. Como no voy usar las nuevas funcionalidades ignoró este warning.

Ahora escribimos en la consola:
sudo make

Sale este mensaje por pantalla:
PostGIS was built successfully. Ready to install.

Volvemos a escribir en la consola:
sudo make install && sudo ldconfig && sudo make comments-install

Volvemos a escribir en la consola:
sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/shp2pgsql && sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/pgsql2shp && sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/raster2pgsql

Ahora cambiamos el password del usuario postgres. Entramos a la consola:
sudo passwd postgres

Sale esto por pantalla:
Introduzca la nueva contraseña de UNIX:
Vuelva a escribir la nueva contraseña de UNIX:
passwd: contraseña actualizada correctamente

Volvemos a escribir en la consola:
su postgres
psql

Una vez dentro de psql, escribimos en la consola:
\password postgres

Sale esto por consola:
Enter new password:
Enter it again:
postgres=#

Ahora salimos.
\q

Creamos una base de datos y en este caso sería template_postgis. Entramos a la consola y tecleamos:
createdb template_postgis
psql -U postgres -d template_postgis -f /usr/share/postgresql/9.6/contrib/postgis-2.3/postgis.sql
psql -U postgres -d template_postgis -f /usr/share/postgresql/9.6/contrib/postgis-2.3/spatial_ref_sys.sql
psql -U postgres -d template_postgis -f /usr/share/postgresql/9.6/contrib/postgis-2.3/postgis_comments.sql

Volvemos a escribir en al consola:
psql template_postgis

Ahora estamos en la base de datos template_postgis. Para saber si esta base de datos contiene postgis, escribimos:
SELECT postgis_full_version();

Y nos saldrá por pantalla:
NOTICE:  Function postgis_gdal_version() not found.  Is raster support enabled and rtpostgis.sql installed?
NOTICE:  Function postgis_raster_scripts_installed() not found. Is raster support enabled and rtpostgis.sql installed?
NOTICE:  Function postgis_raster_lib_version() not found. Is raster support enabled and rtpostgis.sql installed?
postgis_full_version
-----------------------------------------------------------------------------------------------------------------------
POSTGIS="2.3.0 r15146" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" LIBXML="2.9.1" LIBJSON="0.11.99"
(1 fila)

Obs:

  • Como no voy a usar rastre, no me preocupo de la notificación.

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *