postgis / docker-postgis

Docker image for PostGIS
https://hub.docker.com/r/postgis/postgis/
MIT License
1.39k stars 466 forks source link

compile gdal with postgres support #273

Closed mtfurlan closed 2 years ago

mtfurlan commented 2 years ago

I want to import a geojson file into a table. The command I found used ogr2ogr from gdal, but this docker image doesn't compile gdal with postgres support.

Would a PR to compile gdal with postgres support be appreciated?

diff --git a/14-master/Dockerfile b/14-master/Dockerfile
index 8a73ad4..500b757 100644
--- a/14-master/Dockerfile
+++ b/14-master/Dockerfile
@@ -56,7 +56,8 @@ RUN set -ex \
       make \
       pkg-config \
       protobuf-c-compiler \
-      xsltproc
+      xsltproc \
+      libpq-dev

 # sfcgal
 ENV SFCGAL_VERSION master
@@ -131,7 +132,7 @@ RUN set -ex \
     fi \
     \
     && ./autogen.sh \
-    && ./configure --disable-static \
+    && ./configure --disable-static --with-pg \
     && make -j$(nproc) \
     && make install \
     && cd / \

If so, which dockerfiles should be modified?

ImreSamu commented 2 years ago

Would a PR to compile gdal with postgres support be appreciated?

My personal opinion: yes.

But this is only a preliminary opinion; and the final decision is not mine.

If so, which dockerfiles should be modified?

Please add the "current" and the "new" image size ( so we can calculate the increase )

for example the current size: 891MB

$ docker images postgis/postgis:14-master
REPOSITORY        TAG         IMAGE ID       CREATED        SIZE
postgis/postgis   14-master   a00012b8f66a   12 hours ago   891MB
mtfurlan commented 2 years ago

14-master goes from 891MB to 898MB (8MB difference) and 13-master from 888MB to 895MB (7MB difference).

What's the difference between $version-master and $version and $version-alpine tagged images, and when should each be used? It wasn't clear to me from the readme on either github or dockerhub, so I just kinda chose 14-master at random.

I would expect gdal to be compiled with postgres support in all of the images though, as these are docker images specifically for postgis. Why is gdal even present if it can't talk to postgis?

ImreSamu commented 2 years ago

What's the difference between $version-master and $version and $version-alpine tagged images, and when should each be used?

imho:

I would expect gdal to be compiled with postgres support in all of the images though, as these are docker images specifically for postgis.

imho: please verify - the postgis/postgis:14-3.1 is working?

Why is gdal even present if it can't talk to postgis?

Postgis raster support. https://github.com/postgis/postgis/search?p=2&q=gdal

mtfurlan commented 2 years ago

Thanks for the clear summary.

Looks like

So I'm thinking maybe we shouldn't worry about the gdal tools being compiled with postgres in this repo, and I'll go extend the debian image on my own.

If anyone feels strongly feel free to reopen, I can still do a PR.