From alistaire at met.no Tue Aug 18 03:48:07 2026 From: alistaire at met.no (Alistair Everett) Date: Tue, 18 Aug 2026 12:48:07 +0200 Subject: [MapServer-users] Mapfile projection handling Message-ID: 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 *Meteorologisk Institutt*, Henrik Mohns plass 1, 0313 Oslo -------------- next part -------------- An HTML attachment was scrubbed... URL: From jukka.rahkonen at maanmittauslaitos.fi Tue Aug 18 04:01:51 2026 From: jukka.rahkonen at maanmittauslaitos.fi (Rahkonen Jukka) Date: Tue, 18 Aug 2026 11:01:51 +0000 Subject: [MapServer-users] Mapfile projection handling In-Reply-To: References: Message-ID: 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 k?ytt?j?n Alistair Everett via MapServer-users puolesta L?hetetty: Tiistai 18. elokuuta 2026 13.48 Vastaanottaja: MapServer Users 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