[MapServer-dev] MapServer and PROJ Questions

Seth G sethg at geographika.co.uk
Sat Apr 15 05:11:26 PDT 2023

Thanks Even that is very useful. I wasn't aware we could use projection blocks such as:



My test Mapfiles run fine with the PROJECTION examples above, but as you wrote (MapServer is "init=" addict) when requesting through WMS the "init=" is added by MapServer in a few places e.g. [1] which then causes an error. I'll debug further and see if I can find a workaround. 

At some point do you think it would make sense for MapServer to only support PROJ9+? There are lots of places in the codebase checking for various versions of PROJ. Requiring a minimum version would allow consistent Mapfile PROJECTION block syntax too, 


[1] https://github.com/MapServer/MapServer/blob/main/mapfile.c#L1378

twitter: @geographika

On Sat, Apr 15, 2023, at 1:00 PM, Even Rouault wrote:
> Hi Seth,
> init=epsg:XXXX, as a way of doing a lookup in proj.db, is a legacy 
> syntax that was kept only in PROJ >=6 for EPSG. For other authorities, 
> PROJ only recognizes "AUTHORITY_NAME:CODE" for lookups in the database, 
> which enforces the order axis of the CRS definition (so EPSG:4326 != 
> init=epsg:4326 since the former uses lat, long, whereas the later uses 
> long,lat). This might require changes in MapServer which is quite init= 
> addict.
>> 2. Everything works if I create a text file named ESRI and put it in the folder in the PROJ_DATA path. I also tried setting PROJ_DATA (and PROJ_LIB) to multiple folders to allow me to put custom projections in a different folder - as implemented at [2] and described at [3] - "Starting with PROJ 6, multiple directories can be specified. On Unix, they should be separated by the colon (:) character. on Windows, by the semi-colon (;) character."
>> However this doesn't seem to pick up the custom projection file on Windows or Linux e.g. in the mapserver.conf file I set: PROJ_LIB "C:/MapServer/bin/proj9/share;C:/Temp"
> When setting through MapServer, this goes to a different code path using 
> proj_context_set_search_paths()/OSRSetPROJSearchPaths() which require to 
> have done the tokenization, whereas if you set it through a regular 
> environment variable, this is PROJ itself that does the tokenization.
> Should be fixed per https://github.com/MapServer/MapServer/pull/6863
> Even
> -- 
> http://www.spatialys.com
> My software is free, but my time generally not.

More information about the MapServer-dev mailing list