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

Upgrade to Postgres12, latest ogr2ogr in preload #252

Closed
wants to merge 11 commits into from
6 changes: 6 additions & 0 deletions docker/import-data/import_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,18 @@ fi

if [ -z ${1+x} ] || [ "$1" = "natural-earth" ]; then
echo "Importing Natual Earth $INFO..."
# since ogr2ogr v3 NaturalEarth data shows ring self-intersecting failures.
# See https://github.com/OSGeo/gdal/issues/2301
# Adding -skipfailures
# TODO: add -makevalid once it becomes available, or possibly remove
# the -clipsrc, and run an update query afterwards to clip and make geometries valid.
PGCLIENTENCODING=UTF8 ogr2ogr \
-progress \
-f Postgresql \
-s_srs EPSG:4326 \
-t_srs EPSG:3857 \
-clipsrc -180.1 -85.0511 180.1 85.0511 \
-skipfailures \
"PG:$PGCONN" \
-lco GEOMETRY_NAME=geometry \
-lco OVERWRITE=YES \
Expand Down
14 changes: 10 additions & 4 deletions docker/postgis-preloaded/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@ ENV DATA_DIR=/import \
USER root

# NOTE: The ogr2ogr in Debian stable does not support PostgreSQL 12
# Thus parent image must be PG11 or before
RUN DEBIAN_FRONTEND=noninteractive apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
gdal-bin
# Use the sid source instead (Debian unstable). Once gdal 3.0+ is in stable, use this code instead:
#RUN DEBIAN_FRONTEND=noninteractive apt-get update \
# && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
# gdal-bin
RUN set -eux ;\
echo "APT::Default-Release "stable";" > /etc/apt/apt.conf.d/default-release ;\
echo "deb http://ftp.debian.org/debian sid main" > /etc/apt/sources.list.d/sid.list ;\
DEBIAN_FRONTEND=noninteractive apt-get update ;\
DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends -t sid install \
locales-all gdal-bin python3-gdal libgdal26 libnetcdf18 libogdi4.1 libhdf5-hl-100

# switch to postgres user for ownership and execution
USER postgres
Expand Down
2 changes: 1 addition & 1 deletion docker/postgis/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# the postgis base image has outdated ogr2ogr (gdal-bin package)
# does not support PG12 yet, which means postgis-preloaded cannot be built easily.
# Once it is updated, or there is a different way to build it, we can upgrade to 12.
ARG BASE_POSTGIS_VER=9.6-3.0
ARG BASE_POSTGIS_VER=12-3.0
FROM postgis/postgis:$BASE_POSTGIS_VER

LABEL maintainer="Yuri Astrakhan <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion docker/postgis/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# PostGIS + OSM-specific extensions Docker image
[![](https://images.microbadger.com/badges/image/openmaptiles/postgis.svg)](https://microbadger.com/images/openmaptiles/postgis "Get your own image badge on microbadger.com") [![Docker Automated buil](https://img.shields.io/docker/automated/openmaptiles/postgis.svg)]()

This images is based on PostgreSQL 9.6 and PostGIS 3.0 [Docker image](https://hub.docker.com/r/postgis/postgis/) and includes [osml10n extension](https://github.com/giggls/mapnik-german-l10n.git) - OSM-specific label manipulation support.
This images is based on PostgreSQL 12 and PostGIS 3.0 [Docker image](https://hub.docker.com/r/postgis/postgis/) and includes [osml10n extension](https://github.com/giggls/mapnik-german-l10n.git) - OSM-specific label manipulation support.

## Usage

Expand Down
8 changes: 8 additions & 0 deletions docker/postgis/initdb-postgis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ set -o errexit
set -o pipefail
set -o nounset

echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo " Pre-configuring Postgres 12 system"
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
PGUSER="$POSTGRES_USER" psql --dbname="postgres" <<-'EOSQL'
ALTER SYSTEM SET jit = 'off';
EOSQL


echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo " Loading OMT postgis extensions"
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
Expand Down