Kontinuation commented on code in PR #689:
URL: https://github.com/apache/sedona-db/pull/689#discussion_r3087198239


##########
python/sedonadb/python/sedonadb/__init__.py:
##########
@@ -15,16 +15,18 @@
 # specific language governing permissions and limitations
 # under the License.
 from sedonadb import _lib
-from sedonadb.context import connect, configure_proj
+from sedonadb.context import connect, configure_proj, configure_gdal, 
gdal_version
 
 __version__ = _lib.sedona_python_version()
 
 __features__ = _lib.sedona_python_features()
 
-__all__ = ["connect", "options"]
+__all__ = ["connect", "options", "gdal_version"]

Review Comment:
   Removed `gdal_version` in 
https://github.com/apache/sedona-db/pull/689/changes/73956bde818c4026f2cbcb7865c270204fc2d0e2



##########
python/sedonadb/python/sedonadb/context.py:
##########
@@ -585,22 +590,234 @@ def _configure_proj_pyproj():
     )
 
 
-def _configure_proj_system():
+def _proj_lib_name() -> str:
     if sys.platform == "win32":
-        configure_proj(shared_library="proj.dll")
+        return "proj.dll"
     elif sys.platform == "darwin":
-        configure_proj(shared_library="libproj.dylib")
+        return "libproj.dylib"
     else:
-        configure_proj(shared_library="libproj.so")
+        return "libproj.so"
+
+
+def _configure_proj_system():
+    configure_proj(shared_library=_proj_lib_name())
 
 
 def _configure_proj_prefix(prefix: str):
     prefix = Path(prefix)
     if not prefix.exists():
         raise ValueError(f"Can't configure PROJ from prefix '{prefix}': does 
not exist")
 
+    if sys.platform == "win32":
+        shared_library = prefix / "Library" / "bin" / _proj_lib_name()
+    else:
+        shared_library = prefix / "lib" / _proj_lib_name()
+
     configure_proj(
-        shared_library=Path(prefix) / "lib" / "libproj.dylib",
-        database_path=Path(prefix) / "share" / "proj" / "proj.db",
-        search_path=Path(prefix) / "share" / "proj",
+        shared_library=shared_library,
+        database_path=prefix / "share" / "proj" / "proj.db",
+        search_path=prefix / "share" / "proj",
     )
+
+
+def configure_gdal(
+    preset: Optional[
+        Literal["auto", "rasterio", "pyogrio", "conda", "homebrew", "system"]
+    ] = None,
+    *,
+    shared_library: Optional[Union[str, Path]] = None,
+    verbose: bool = False,
+) -> None:
+    """Configure GDAL source
+
+    SedonaDB loads GDAL dynamically at runtime. This is normally configured
+    on package load but may need additional configuration (particularly if the
+    automatic configuration fails).
+
+    This function may be called at any time; however, once a GDAL-backed
+    operation has been performed, subsequent configuration has no effect.
+
+    Args:
+        preset: One of:
+            - None: Use a custom `shared_library` path.
+            - auto: Try all presets in the order pyogrio, rasterio, conda,

Review Comment:
   Fixed in 
https://github.com/apache/sedona-db/pull/689/changes/73956bde818c4026f2cbcb7865c270204fc2d0e2



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to