postgis / docker-postgis

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

Missing postgis_sfcgal in alpine image #293

Closed Cactusbone closed 1 year ago

Cactusbone commented 2 years ago

Using docker run --rm --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgis/postgis:14-3.2-alpine AND docker run -it --rm --link some-postgres postgres psql postgresql://postgres:mysecretpassword@some-postgres -c "CREATE EXTENSION postgis_sfcgal;" -c "SELECT ST_AsGeoJSON(ST_StraightSkeleton(ST_GeomFromText('POLYGON (( 190 190, 10 190, 10 10, 190 10, 190 20, 160 30, 60 30, 60 130, 190 140, 190 190 ))')))"

I end up with

ERROR:  could not open extension control file "/usr/local/share/postgresql/extension/postgis_sfcgal.control": No such file or directory
ERROR:  function st_straightskeleton(geometry) does not exist
LINE 1: SELECT ST_AsGeoJSON(ST_StraightSkeleton(ST_GeomFromText('POL...

This works well with the debian version of the same image.

ImreSamu commented 2 years ago

confirmed; in the Alpine PostGIS build - the: SFCGAL support is disabled; ( as I see in the build log )

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

Adding "SFCGAL support" is not so easy (now);

so NOW: the "debian version" is recommended.

orca-hydromancer commented 1 year ago

Adding "SFCGAL support" is not so easy (now);

How about now?

ImreSamu commented 1 year ago

@orca-hydromancer :

How about now?

in the curent alpine:3.17 no cgal package yet:

orca-hydromancer commented 1 year ago

Is it a requirement it be a package in alpine? CGAL is headers only library now, easy to include. Its soft dependencies gmp and mpfr are available in Alpine.

ImreSamu commented 1 year ago

Hi @orca-hydromancer

Is it a requirement it be a package in alpine?

(my personal opinion) Ideally:

In practice, it is not always possible to apply this strategy.

The best thing would be to have SFCGAL as a supported package in Alpine in the future: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/34158

CGAL is headers only library now, easy to include.

Yes, I'm currently testing with -master image ( https://github.com/postgis/docker-postgis/pull/337 ), and if there is no other solution, we really need to think about the pros and cons of the local SFCGAL builds in the Alpine.

If you have any specific suggestions on these, please let me know.

ImreSamu commented 1 year ago

good news: sfcgal in the alpine:edge ( "edge" is a development branch )

~$ docker run -it --rm --network=host alpine:edge

/ # cat /etc/alpine-release
3.18_alpha20230208

/ # apk add sfcgal
fetch https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
(1/7) Installing libgcc (12.2.1_git20220924-r9)
(2/7) Installing boost1.81-serialization (1.81.0-r1)
(3/7) Installing gmp (6.2.1-r2)
(4/7) Installing libstdc++ (12.2.1_git20220924-r9)
(5/7) Installing libgmpxx (6.2.1-r2)
(6/7) Installing mpfr4 (4.2.0-r0)
(7/7) Installing sfcgal (1.4.1-r2)
OK: 20 MiB in 22 packages
/ #