<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">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.<div><br></div><div>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.</div><div><br></div><div>Howard</div><div><br id="lineBreakAtBeginningOfMessage"><div><br><blockquote type="cite"><div>On May 14, 2024, at 8:37 PM, wong shek <wong.shek@outlook.com> wrote:</div><br class="Apple-interchange-newline"><div><meta charset="UTF-8"><div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; color: rgb(13, 13, 13);"><span style="background-color: rgb(255, 255, 255);">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.</span></div><div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; color: rgb(13, 13, 13);"><span style="background-color: rgb(255, 255, 255);"><br></span></div><div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; color: rgb(13, 13, 13);"><span style="background-color: rgb(255, 255, 255);">PS: OSRSetPROJSearchPaths function in GDAL</span></div><div id="appendonsend" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"></div><hr tabindex="-1" style="font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; display: inline-block; width: 572.3125px;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;"></span><div id="divRplyFwdMsg" dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><font face="Calibri, sans-serif" style="font-size: 11pt;"><b>发件人:</b><span class="Apple-converted-space"> </span>Howard Butler <howard@hobu.co><br><b>发送时间:</b><span class="Apple-converted-space"> </span>2024年5月14日 6:28<br><b>收件人:</b><span class="Apple-converted-space"> </span>wong shek <wong.shek@outlook.com><br><b>抄送:</b><span class="Apple-converted-space"> </span>pdal@lists.osgeo.org <pdal@lists.osgeo.org><br><b>主题:</b><span class="Apple-converted-space"> </span>Re: [pdal] How to set proj search path using PDAL c++ API</font><div> </div></div><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; line-break: after-white-space;"><br id="x_lineBreakAtBeginningOfMessage"><div><br><blockquote type="cite"><div>On May 10, 2024, at 10:02 PM, wong shek via pdal <pdal@lists.osgeo.org> wrote:</div><br class="x_Apple-interchange-newline"><div><div style="margin-top: 0px; margin-bottom: 0px; font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; direction: ltr; text-align: left; background-color: rgb(255, 255, 255);"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt;">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.</span></div></div></blockquote><br></div><div>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). </div></div></div></blockquote></div><br></div></body></html>