[MapServer-users] Mapfile projection handling

Alistair Everett alistaire at met.no
Tue Aug 18 03:48:07 PDT 2026


Hi all,

I've noticed that defining a projection as for example "EPSG:4236" seems to
be internally converted into "init=epsg:4326". I was wondering if this is
intentional since "init=" is deprecated/no longer recommended with proj?

The way I stumbled on this is a little strange (and not a use case which I
am suggesting should be supported), but the behaviour was a little
unexpected and made me wonder if this was really the intention.

We had a request from a user who has been using a custom EPSG code which
they asked if we could support (we have recommended they don't do this, and
switch to a custom prefix instead of EPSG), but in order to test if we
could support this I created a file called epsg in /usr/share/proj
containing the new projection. What I expected was that I could use
"init=epsg:613913" to get this projection. This worked, but a side effect
was that all of our existing standard projections eg. "EPSG:4326" broke
with the error:

_mapscript.MapServerError: msProcessProjection(): Projection library error.
PROJ error "Invalid value for an argument" when instantiating
"init=epsg:4326"

So it appears that regardless of how one writes the projection in the
mapfile, it is being converted to "init=epsg:4326" and then if an epsg file
exists it will only use this with no fallback or possibility of using the
proj database. The conversion to "init=" seems to happen in the
msLoadProjectionStringEPSGLike() function, L1376 in mapfile.c. I wondered
what the motivation was for converting to "init=", but perhaps this is just
a legacy which is hard to get rid of?

Tested with:
MapServer version 8.4.0 PROJ version 9.4 GDAL version 3.11 OUTPUT=PNG
OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO
SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT
SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER
SUPPORTS=SOS_SERVER SUPPORTS=OGCAPI_SERVER SUPPORTS=FASTCGI
SUPPORTS=THREADS SUPPORTS=GEOS SUPPORTS=PBF INPUT=JPEG INPUT=OGR INPUT=GDAL
INPUT=SHAPEFILE INPUT=FLATGEOBUF

Thanks,
Alistair

-----------------------------
*Dr Alistair Everett*
Senioringeniør / Senior Software Engineer
Avdeling for Geoutvikling

*Phone:* +47 939 68 985
*Email:* alistair.everett at met.no <alistaire at met.no>

*Meteorologisk Institutt*,
Henrik Mohns plass 1,
0313 Oslo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20260818/7e03aa58/attachment-0001.htm>


More information about the MapServer-users mailing list