[mapserver-dev] Projections and CONFIG file in MapServer 8.0

Seth G sethg at geographika.co.uk
Thu Jul 7 07:07:11 PDT 2022


Thanks a million Even for looking at this. I've built your modified branch, and now trying to recreate the issue on my current setup, and will then test with the new build. 

So the version of Proj is always fixed when compiled, and setting PROJ_LIB just points to the resource files?
When using MapServer Proj7 still works fine even when pointing to a /proj/share folder containing just the epsg text files, and also works when pointing to a proj7/share folder containing proj.db. 
I'd assumed MapServer was doing some clever switching between versions somewhere, but in fact proj7 is backwards compatible and doesn't necessarily require proj.db - is that correct?

Seth


--
web:https://geographika.net
twitter: @geographika

On Thu, Jul 7, 2022, at 3:26 PM, Even Rouault wrote:
> Hi Seth,
>
>> Thanks, Steve and Jeff for the feedback.
>> As system environment variables never worked with IIS (only FastCGI environment variables) I was only ever able to configure PROJ_LIB in a Mapfile.
>>
>> Logically, I'd assume a Mapfile would override a CONFIG setting, as it is the last/top setting. However, as PROJ_LIB can be used to load a DLL from any location then I can see why it would make sense to lock it down in the CONFIG file.
> PROJ_LIB name is a bit misleading: it cannot be used to load executable 
> code/.dll. A more suitable name would have been PROJ_DATA.
>> I'll have a dig into the code to see why it sometimes uses one and sometimes the other setting - ideally we'd make a call on which has priority and make sure it works consistently.
>
> Could you test if https://github.com/MapServer/MapServer/pull/6565 helps 
> ? Reviewing how config options set in mapfile were processed, I see that 
> PROJ_LIB setting involves a special processing, which wasn't replicated 
> when setting it from the config file.
>
> Even
>
>>
>> Seth
>>
>>
>> --
>> web:https://geographika.net
>> twitter: @geographika
>>
>> On Thu, Jul 7, 2022, at 1:27 AM, Jeff McKenna wrote:
>>> I can dream of a 'PROJ_LIB_LOCATION_PRIORITY' setting in the MapServer
>>> .conf file:
>>>
>>>     1 : use .conf setting
>>>     2 : use setting inside your .mapfile or .include
>>>     3 : use setting from Web Server (Apache conf, etc.)
>>>     4 : use setting at the System environment level [warning to Windows
>>> Server admins, this is problematic on some systems in several ways:
>>> often not found, or conflicts with other FOSS4G software settings for PROJ]
>>>
>>>
>>> Or, the old rule applies here: 'never send an important email after 6pm' ha!
>>>
>>> Thanks for listening,
>>>
>>> -jeff
>>>
>>>
>>>
>>>
>>>
>>>
>>> On 2022-07-06 8:12 p.m., Jeff McKenna wrote:
>>>> Ok thanks Steve, but can you be more specific regarding 'local setting'?
>>>>    On Windows each FOSS4G software has its own PROJ instance/version and
>>>> its own PROJ_LIB variable (yes it's complete disaster, waiting to
>>>> happen).  So where does the mapfile's PROJ_LIB setting, and then the
>>>> System environment variable fit into your 3 ?
>>>>
>>>> Thanks,
>>>>
>>>> -jeff
>>>>
>>>>
>>>>
>>>> On 2022-07-06 6:44 p.m., Steve Lime wrote:
>>>>> I understand your logic and would agree for most things. However, one
>>>>> benefit of the config file is to allow admins to lock things down -
>>>>> especially items like environment variable settings that tell
>>>>> MapServer to load code. Hence my original response, so 1) config file,
>>>>> 2) web server environment, 3) local setting.
>>>>>
>>>>> --Steve
>>>>>
>>>>> On Wed, Jul 6, 2022 at 4:05 PM Jeff McKenna
>>>>> <jmckenna at gatewaygeomatics.com <mailto:jmckenna at gatewaygeomatics.com>>
>>>>> wrote:
>>>>>
>>>>>      Oh don't forget PostGIS' use of that same variable (that's where I
>>>>> hit
>>>>>      this on servers constantly).
>>>>>
>>>>>      So, my point is, that the only way we can avoid all this
>>>>> "environment"
>>>>>      variable chaos is first always use the local mapfile setting, then
>>>>> look
>>>>>      for .conf, and if neither has this, check the other sources.
>>>>>
>>>>>      -jeff
>>>>>
>>>>>
>>>>>
>>>>>      On 2022-07-06 6:01 p.m., Jeff McKenna wrote:
>>>>>       > I think we have several possibilities: environment var (system
>>>>>       > variable), web server environment variable (Apache config),
>>>>>      MapServer
>>>>>       > .conf, and local mapfile setting.
>>>>>       >
>>>>>       > I would say that the local mapfile should always be used first by
>>>>>       > MapServer, in this order:
>>>>>       >
>>>>>       > - check mapfile setting,
>>>>>       > - if not found, check for MapServer .conf setting,
>>>>>       > - if not found, check for web server setting
>>>>>       > - if not found, check for system environment variable
>>>>>       > - ...else, battle for superiority with the other PROJ_LIB
>>>>>      settings by
>>>>>       > the other FOSS4G software on that container
>>>>>       >
>>>>>       > Notes:
>>>>>       >
>>>>>       > - this shared PROJ_LIB issue is not just for MapServer, but is
>>>>>      faced by
>>>>>       > all FOSS4G projects that share this variable.  On Windows servers
>>>>>      now it
>>>>>       > is common for me to have several PROJ_LIB settings, one for each
>>>>>      FOSS4G
>>>>>       > software that depends on (depends on that PROJ version for that
>>>>>       > software), such as QGIS, GDAL, MapServer, etc. etc.  Meaning: f
>>>>>      you need
>>>>>       > a job run for one software, enable that specific PROJ_LIB.
>>>>>       >
>>>>>       > It's fun :)
>>>>>       >
>>>>>       > -jeff
>>>>>       >
>>>>>       >
>>>>>       >
>>>>>       >
>>>>>       >
>>>>>       > On 2022-07-06 5:49 p.m., Steve Lime wrote:
>>>>>       >> This could/would have been the case in past versions as well,
>>>>>      right?
>>>>>       >> So I don't think this is a new issue. IMHO I'd think central
>>>>> config
>>>>>       >> settings should trump local settings for something like this.
>>>>>       >>
>>>>>       >> On Wed, Jul 6, 2022 at 2:40 PM Seth G <sethg at geographika.co.uk
>>>>>      <mailto:sethg at geographika.co.uk>
>>>>>       >> <mailto:sethg at geographika.co.uk
>>>>>      <mailto:sethg at geographika.co.uk>>> wrote:
>>>>>       >>
>>>>>       >>     Hi all,
>>>>>       >>
>>>>>       >>     Using MapServer 8.0 beta and FastCGI (on Windows) I'm
>>>>>      running into
>>>>>       >>     an issue where the PROJ_LIB setting is sometimes set by the
>>>>>      value in
>>>>>       >>     the CONFIG file and sometimes by the setting in the Mapfile:
>>>>>       >>
>>>>>       >>     CONFIG
>>>>>       >>        ENV
>>>>>       >>          MS_MAP_PATTERN "."
>>>>>       >>          PROJ_LIB "C:/MapServer/bin/proj7/share" #proj7
>>>>>       >>        END
>>>>>       >>     END
>>>>>       >>
>>>>>       >>     Then in a Mapfile:
>>>>>       >>
>>>>>       >>     CONFIG "PROJ_LIB" "C:/MapServer/bin/proj/SHARE" # uses proj6
>>>>>       >>
>>>>>       >>     Requests will use one PROJ setting then switch to another
>>>>>      seemingly
>>>>>       >>     at random.
>>>>>       >>     Should one always take precedence over the other?
>>>>>       >>
>>>>>       >>     Seth
>>>>>       >>
>>>>>       >>     --
>>>>>       >>     web:https://geographika.net <https://geographika.net>
>>>>>      <https://geographika.net <https://geographika.net>>
>>>>>       >>     twitter: @geographika
>>>>>       >
>>>>>
>>>> _______________________________________________
>>>> MapServer-dev mailing list
>>>> MapServer-dev at lists.osgeo.org
>>>> https://lists.osgeo.org/mailman/listinfo/mapserver-dev
>>> -- 
>>> Jeff McKenna
>>> GatewayGeo: Developers of MS4W, MapServer Consulting and Training
>>> co-founder of FOSS4G
>>> http://gatewaygeo.com/
>>>
>>> _______________________________________________
>>> MapServer-dev mailing list
>>> MapServer-dev at lists.osgeo.org
>>> https://lists.osgeo.org/mailman/listinfo/mapserver-dev
>> _______________________________________________
>> MapServer-dev mailing list
>> MapServer-dev at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/mapserver-dev
>
> -- 
> http://www.spatialys.com
> My software is free, but my time generally not.


More information about the MapServer-dev mailing list