Open pvgenuchten opened 2 months ago
@geographika indicates it may be related to moving from proj_lib env to proj_data env, based on version of proj
see https://proj.org/en/9.4/usage/environmentvars.html
I added an env param PROJ_DATA, but it has no effect
proj --version
Rel. 9.4.0, March 1st, 2024
Ok, we found the problem, I'm used to starting my mapfiles with
CONFIG 'PROJ_LIB' '/usr/share/proj/'
With the new version of proj this is problematic, and causes above error.
Because proj resources are on a default location, you can however remove the config line, and all works fine
I can recreate the error by setting the following in a Mapfile in the master Docker image (before any PROJECTION blocks):
CONFIG "PROJ_DATA" "/usr/share/proj/"
I get msProcessProjection(): Projection library error. proj error "Invalid PROJ string syntax" for "init=epsg:4326"
If I set it to the following it runs fine:
CONFIG "PROJ_DATA" "/usr/local/share/proj/"
The base image at https://github.com/OSGeo/gdal/blob/master/docker/ubuntu-small/Dockerfile builds PROJ so I'm not sure why there is a difference. It does download grids from http://download.osgeo.org/proj/proj-datumgrid-latest.zip and puts them in the image - maybe these are incompatible with the PROJ version?
(Probably unrelated) - I don't fully understand the symlink here: https://github.com/camptocamp/docker-mapserver/blob/1445ddc37b439a755bf9ca1515501a8d9921b48d/Dockerfile#L17 - is this tied to a specific PROJ version?
@sbrunner @geographika I closed as completed, but maybe we should reopen to facilitate more research or documentation
The GDAL base image builds the master version of PROJ from whenever it is tagged (ARG PROJ_VERSION=master
). The MapServer Docker image uses ubuntu-small-3.8.5 as gdal as the base image, so the version of PROJ used is whatever is in master at this point in time. The corresponding PROJ DATA files are installed to /usr/local/share/proj/
(ARG PROJ_INSTALL_PREFIX=/usr/local
).
I'm not sure, but I'm guessing another version of PROJ is installed onto the image.
https://github.com/camptocamp/docker-mapserver/blob/master/ci/dpkg-versions.yaml has ubuntu_22_04/libproj22: 8.2.1-1
listed - maybe this is a dependency of something else? I think this installs to /usr/share/proj/
but doesn't match the PROJ version causing the error.
Shouldn't we simply add the environment variable PROJ_DATA
in the Dockerfile
:
ENV PROJ_DATA=/usr/share/proj/
I tried a env param proj_data, no effect, either gets overwritten by the config in mapfile or there is a problem with the path; usr/share/proj vs usr/local/share/proj
I don't fully understand the symlink here: ...
This is just to make the build work
Shouldn't we simply add the environment variable
PROJ_DATA
in theDockerfile
:ENV PROJ_DATA=/usr/share/proj/
Assuming the PROJ install in pkg-versions.yaml is required, then I think updating the sample in mapserver.conf is enough (note the working value is /usr/local/share/proj/
). The container is working fine for me without having to set PROJ_DATA (or PROJ_LIB) (I presume it defaults to the correct location?).
@pvgenuchten - a PROJ_DATA setting in a Mapfile will always take precedence over any environment setting or setting in mapserver.conf - I'd suggest removing these and if a custom path is needed setting it in mapserver.conf.
Note, from https://github.com/MapServer/MapServer/pull/6573 on the deprecation plan for PROJ_LIB:
PROJ 9.1 recognizes the PROJ_DATA environment variable, as a replacement for PROJ_LIB (both are still recognized by PROJ >= 9.1. PROJ_LIB will be retired in PROJ 10, whose release is unplanned for now)
Assuming the PROJ install in pkg-versions.yaml is required,
No, the version in this file is not required, this file is just used to trigger a rebuild when a package is updated.
I just tried to reproduce the issue and I didn't succeed, can you share the files you used to reproduce it?
@sbrunner - the following setup should trigger the error. The data isn't required - just setting the CONFIG "PROJ_DATA" "/usr/share/proj/"
in the Mapfile. Not a major issue IMO but not sure what version of PROJ is added to the container in /usr/share/proj/
(and how).
docker pull camptocamp/mapserver:master
docker run --name mapserver_master -d -p 8080:80 -v /exercises/mapfiles:/etc/mapserver/mapfiles camptocamp/mapserver:master
docker exec -it mapserver_master /bin/bash
mapserv -nh "QUERY_STRING=map=/etc/mapserver/mapfiles/countries.map&mode=map"
# msProcessProjection(): Projection library error. proj error "Invalid PROJ string syntax" for "init=epsg:4326"
# docker stop mapserver_master
# docker rm mapserver_master
Mapfile:
MAP
NAME "mymap"
SIZE 800 400
CONFIG "PROJ_DATA" "/usr/share/proj/"
PROJECTION
"init=epsg:4326"
END
EXTENT -180 -90 180 90
LAYER
NAME "countries"
TYPE POLYGON
STATUS DEFAULT
CONNECTIONTYPE FLATGEOBUF
DATA "data/naturalearth/ne_110m_admin_0_countries.fgb"
CLASS
STYLE
COLOR 60 179 113
OUTLINECOLOR 255 255 255
WIDTH 1
END
END
END
END
I can reproduced also on my side. The fix looks good (remove CONFIG PROJ_LIB).
the latest master image gives me problems with projections, something changed in image build (or mapserver)?
msProcessProjection(): Projection library error. proj error "Invalid PROJ string syntax" for "EPSG:4326"
also tried init=epsg:4326
the master image of last month works fine...