[pdal] How to set proj search path using PDAL c++ API

Howard Butler howard at hobu.co
Wed May 15 06:20:06 PDT 2024


I'm still confused. If you set PROJ_DATA *before your process starts* in your execution environment and you never need to change it during the execution of the PDAL library there will be no threading issue.

If you are running PDAL in your own C++ program and using the library, call this function yourself from GDAL. There isn't a natural place in the PDAL API to put such a bookkeeping call.

Howard


> On May 14, 2024, at 8:37 PM, wong shek <wong.shek at outlook.com> wrote:
> 
> Thank you for your response. I am unlikely to modify the PROJ_DATA environment variable across different threads simultaneously, but I still prefer a thread-safe solution, similar to OSRSetPROJSearchPaths. The function putenv/putenv_s used to set environment variables in C++ is likely not thread-safe, though it is process-safe.
> 
> PS: OSRSetPROJSearchPaths function in GDAL
> 发件人: Howard Butler <howard at hobu.co>
> 发送时间: 2024年5月14日 6:28
> 收件人: wong shek <wong.shek at outlook.com>
> 抄送: pdal at lists.osgeo.org <pdal at lists.osgeo.org>
> 主题: Re: [pdal] How to set proj search path using PDAL c++ API
>  
> 
> 
>> On May 10, 2024, at 10:02 PM, wong shek via pdal <pdal at lists.osgeo.org> wrote:
>> 
>> In GDAL, I can set the PROJ search paths using OSRSetPROJSearchPaths, but I can't find a similar method in PDAL. I prefer not to use the approach of setting the PROJ_LIB environment variable because it's not thread-safe.
> 
> I'm not sure what you mean by not thread-safe here. Are you changing the search path location per-thread? IIRC, the paths are loaded in thread-local storage when they are set via the environment variables. I don't understand what you mean by a thread-safe issue in regards to setting the PROJ_LIB (you should use PROJ_DATA going forward, it was relabeled to align with GDAL_DATA and to make it clear it was pointing at support data and not the PROJ .so). 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pdal/attachments/20240515/d388053f/attachment.htm>


More information about the pdal mailing list