Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add postgis extention #5

Merged
merged 4 commits into from
Dec 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/postgresql/tests/test_postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,15 @@ def test_uuid_ossp_extension(tmp_postgres):
def test_xml2_extension(tmp_postgres):
pgdata, con_str = tmp_postgres
postgresql.psql(f'-d "{con_str}" -c "CREATE EXTENSION xml2;"')


def test_postgis_extension(tmp_postgres):
pgdata, con_str = tmp_postgres
postgresql.psql(f'-d "{con_str}" -c "CREATE EXTENSION postgis;"')
postgresql.psql(f'-d "{con_str}" -c "CREATE EXTENSION postgis_raster;"')
postgresql.psql(f'-d "{con_str}" -c "CREATE EXTENSION postgis_topology;"')
postgresql.psql(f'-d "{con_str}" -c "CREATE EXTENSION postgis_sfcgal;"')
postgresql.psql(f'-d "{con_str}" -c "CREATE EXTENSION fuzzystrmatch;"')
postgresql.psql(f'-d "{con_str}" -c "CREATE EXTENSION address_standardizer;"')
postgresql.psql(f'-d "{con_str}" -c "CREATE EXTENSION address_standardizer_data_us;"')
postgresql.psql(f'-d "{con_str}" -c "CREATE EXTENSION postgis_tiger_geocoder;"')
21 changes: 18 additions & 3 deletions src/tools/install_pg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,32 @@ then
else
VERSION=13.4
fi
JOBS_NUMBER=4
POSTGIS_VERSION=3.2.0

export DEBIAN_FRONTEND=noninteractive

sudo apt update
sudo apt install -y zlib1g-dev libreadline-dev libossp-uuid-dev libxml2-dev libxslt1-dev curl make gcc
curl -L -O https://ftp.postgresql.org/pub/source/v${VERSION}/postgresql-${VERSION}.tar.gz
sudo apt install -y zlib1g-dev libreadline-dev libossp-uuid-dev libxml2-dev \
libxslt1-dev curl make gcc pkg-config libgeos-dev libxml2-utils \
libjson-c-dev proj-bin g++ libsqlite3-dev libtiff-dev \
libcurl4-gnutls-dev libprotobuf-c-dev libgdal-dev libsfcgal-dev \
libproj-dev protobuf-c-compiler

# Build Postgresql
curl -L -O https://ftp.postgresql.org/pub/source/v${VERSION}/postgresql-${VERSION}.tar.gz
tar -xzf postgresql-${VERSION}.tar.gz
cd postgresql-${VERSION}
./configure --prefix=`pwd`/../src/postgresql --with-ossp-uuid --with-libxml --with-libxslt
make -j 4 world-bin
make -j ${JOBS_NUMBER} world-bin
make install-world-bin
cd ..

# Build PostGIS
curl -L -O https://download.osgeo.org/postgis/source/postgis-${POSTGIS_VERSION}.tar.gz
tar -xzvf postgis-${POSTGIS_VERSION}.tar.gz
cd postgis-${POSTGIS_VERSION}
./configure --with-pgconfig=`pwd`/../src/postgresql/bin/pg_config
make -j ${JOBS_NUMBER}
make install
cd ..