[MapServer-users] Mapfile projection handling
Rahkonen Jukka
jukka.rahkonen at maanmittauslaitos.fi
Tue Aug 18 04:01:51 PDT 2026
Hi,
Perhaps you should use different PROJ_DATA in your mapfiles https://mapserver.org/mapfile/projection.html#setting-the-location-of-proj-files for selecting between proj.db and epsg text file. But I think that PROJ_DATA affects the whole mapfile and it is not possible to use different CRS definition sources for layers in the same mapfile.
-Jukka Rahkonen-
________________________________________
Lähettäjä: MapServer-users <mapserver-users-bounces at lists.osgeo.org> käyttäjän Alistair Everett via MapServer-users <mapserver-users at lists.osgeo.org> puolesta
Lähetetty: Tiistai 18. elokuuta 2026 13.48
Vastaanottaja: MapServer Users <mapserver-users at lists.osgeo.org>
Aihe: [MapServer-users] Mapfile projection handling
HUOM! Ulkoinen lähettäjä. Älä avaa linkkejä tai liitteitä, ellet tunnista lähettäjää. OBS! Extern avsändare. Öppna inte länkar eller bilagor om du inte känner igen avsändaren. NOTE! External sender. Do not open links or attachments unless you recognize the sender. 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=FLATGEOBUFThanks,Alistair-----------------------------Dr Alistair EverettSenioringeniør / Senior Software EngineerAvdeling for GeoutviklingPhone: +47 939 68 985Email: alistair.everett at met.noMeteorologisk Institutt,Henrik Mohns plass 1, 0313 Oslo
More information about the MapServer-users
mailing list