pyogrio 0.10.0__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pyogrio might be problematic. Click here for more details.
- pyogrio/__init__.py +68 -0
- pyogrio/_compat.py +47 -0
- pyogrio/_env.py +59 -0
- pyogrio/_err.c +11520 -0
- pyogrio/_err.cp313-win_amd64.pyd +0 -0
- pyogrio/_geometry.c +8157 -0
- pyogrio/_geometry.cp313-win_amd64.pyd +0 -0
- pyogrio/_io.c +68161 -0
- pyogrio/_io.cp313-win_amd64.pyd +0 -0
- pyogrio/_ogr.c +14826 -0
- pyogrio/_ogr.cp313-win_amd64.pyd +0 -0
- pyogrio/_version.py +21 -0
- pyogrio/_vsi.c +11871 -0
- pyogrio/_vsi.cp313-win_amd64.pyd +0 -0
- pyogrio/core.py +386 -0
- pyogrio/errors.py +25 -0
- pyogrio/gdal_data/GDAL-targets-release.cmake +20 -0
- pyogrio/gdal_data/GDAL-targets.cmake +105 -0
- pyogrio/gdal_data/GDALConfig.cmake +23 -0
- pyogrio/gdal_data/GDALConfigVersion.cmake +85 -0
- pyogrio/gdal_data/GDALLogoBW.svg +138 -0
- pyogrio/gdal_data/GDALLogoColor.svg +126 -0
- pyogrio/gdal_data/GDALLogoGS.svg +126 -0
- pyogrio/gdal_data/LICENSE.TXT +467 -0
- pyogrio/gdal_data/MM_m_idofic.csv +321 -0
- pyogrio/gdal_data/copyright +467 -0
- pyogrio/gdal_data/cubewerx_extra.wkt +48 -0
- pyogrio/gdal_data/default.rsc +0 -0
- pyogrio/gdal_data/ecw_cs.wkt +1453 -0
- pyogrio/gdal_data/eedaconf.json +23 -0
- pyogrio/gdal_data/epsg.wkt +1 -0
- pyogrio/gdal_data/esri_StatePlane_extra.wkt +631 -0
- pyogrio/gdal_data/gdalicon.png +0 -0
- pyogrio/gdal_data/gdalinfo_output.schema.json +346 -0
- pyogrio/gdal_data/gdalmdiminfo_output.schema.json +321 -0
- pyogrio/gdal_data/gdaltileindex.xsd +269 -0
- pyogrio/gdal_data/gdalvrt.xsd +880 -0
- pyogrio/gdal_data/gfs.xsd +246 -0
- pyogrio/gdal_data/gml_registry.xml +117 -0
- pyogrio/gdal_data/gml_registry.xsd +66 -0
- pyogrio/gdal_data/grib2_center.csv +251 -0
- pyogrio/gdal_data/grib2_process.csv +102 -0
- pyogrio/gdal_data/grib2_subcenter.csv +63 -0
- pyogrio/gdal_data/grib2_table_4_2_0_0.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_1.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_13.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_14.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_15.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_16.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_17.csv +11 -0
- pyogrio/gdal_data/grib2_table_4_2_0_18.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_19.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_190.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_191.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_2.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_20.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_21.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_3.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_4.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_5.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_6.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_7.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_10_0.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_10_1.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_10_191.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_10_2.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_10_3.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_10_4.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_1_0.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_1_1.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_1_2.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_20_0.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_20_1.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_20_2.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_2_0.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_2_3.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_2_4.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_2_5.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_2_6.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_3_0.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_3_1.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_3_2.csv +28 -0
- pyogrio/gdal_data/grib2_table_4_2_3_3.csv +8 -0
- pyogrio/gdal_data/grib2_table_4_2_3_4.csv +14 -0
- pyogrio/gdal_data/grib2_table_4_2_3_5.csv +11 -0
- pyogrio/gdal_data/grib2_table_4_2_3_6.csv +11 -0
- pyogrio/gdal_data/grib2_table_4_2_4_0.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_4_1.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_4_10.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_4_2.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_4_3.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_4_4.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_4_5.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_4_6.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_4_7.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_4_8.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_4_9.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_local_Canada.csv +5 -0
- pyogrio/gdal_data/grib2_table_4_2_local_HPC.csv +2 -0
- pyogrio/gdal_data/grib2_table_4_2_local_MRMS.csv +175 -0
- pyogrio/gdal_data/grib2_table_4_2_local_NCEP.csv +401 -0
- pyogrio/gdal_data/grib2_table_4_2_local_NDFD.csv +38 -0
- pyogrio/gdal_data/grib2_table_4_2_local_index.csv +7 -0
- pyogrio/gdal_data/grib2_table_4_5.csv +261 -0
- pyogrio/gdal_data/grib2_table_versions.csv +3 -0
- pyogrio/gdal_data/gt_datum.csv +229 -0
- pyogrio/gdal_data/gt_ellips.csv +24 -0
- pyogrio/gdal_data/header.dxf +1124 -0
- pyogrio/gdal_data/inspire_cp_BasicPropertyUnit.gfs +57 -0
- pyogrio/gdal_data/inspire_cp_CadastralBoundary.gfs +60 -0
- pyogrio/gdal_data/inspire_cp_CadastralParcel.gfs +81 -0
- pyogrio/gdal_data/inspire_cp_CadastralZoning.gfs +161 -0
- pyogrio/gdal_data/jpfgdgml_AdmArea.gfs +59 -0
- pyogrio/gdal_data/jpfgdgml_AdmBdry.gfs +49 -0
- pyogrio/gdal_data/jpfgdgml_AdmPt.gfs +59 -0
- pyogrio/gdal_data/jpfgdgml_BldA.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_BldL.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_Cntr.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_CommBdry.gfs +49 -0
- pyogrio/gdal_data/jpfgdgml_CommPt.gfs +59 -0
- pyogrio/gdal_data/jpfgdgml_Cstline.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_ElevPt.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_GCP.gfs +94 -0
- pyogrio/gdal_data/jpfgdgml_LeveeEdge.gfs +49 -0
- pyogrio/gdal_data/jpfgdgml_RailCL.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_RdASL.gfs +44 -0
- pyogrio/gdal_data/jpfgdgml_RdArea.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_RdCompt.gfs +59 -0
- pyogrio/gdal_data/jpfgdgml_RdEdg.gfs +59 -0
- pyogrio/gdal_data/jpfgdgml_RdMgtBdry.gfs +49 -0
- pyogrio/gdal_data/jpfgdgml_RdSgmtA.gfs +59 -0
- pyogrio/gdal_data/jpfgdgml_RvrMgtBdry.gfs +49 -0
- pyogrio/gdal_data/jpfgdgml_SBAPt.gfs +49 -0
- pyogrio/gdal_data/jpfgdgml_SBArea.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_SBBdry.gfs +44 -0
- pyogrio/gdal_data/jpfgdgml_WA.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_WL.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_WStrA.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_WStrL.gfs +54 -0
- pyogrio/gdal_data/nitf_spec.xml +3306 -0
- pyogrio/gdal_data/nitf_spec.xsd +189 -0
- pyogrio/gdal_data/ogrinfo_output.schema.json +528 -0
- pyogrio/gdal_data/ogrvrt.xsd +546 -0
- pyogrio/gdal_data/osmconf.ini +132 -0
- pyogrio/gdal_data/ozi_datum.csv +131 -0
- pyogrio/gdal_data/ozi_ellips.csv +35 -0
- pyogrio/gdal_data/pci_datum.txt +530 -0
- pyogrio/gdal_data/pci_ellips.txt +129 -0
- pyogrio/gdal_data/pdfcomposition.xsd +721 -0
- pyogrio/gdal_data/pds4_template.xml +65 -0
- pyogrio/gdal_data/plscenesconf.json +1985 -0
- pyogrio/gdal_data/ruian_vf_ob_v1.gfs +1455 -0
- pyogrio/gdal_data/ruian_vf_st_uvoh_v1.gfs +86 -0
- pyogrio/gdal_data/ruian_vf_st_v1.gfs +1489 -0
- pyogrio/gdal_data/ruian_vf_v1.gfs +2126 -0
- pyogrio/gdal_data/s57agencies.csv +249 -0
- pyogrio/gdal_data/s57attributes.csv +484 -0
- pyogrio/gdal_data/s57expectedinput.csv +1008 -0
- pyogrio/gdal_data/s57objectclasses.csv +287 -0
- pyogrio/gdal_data/seed_2d.dgn +0 -0
- pyogrio/gdal_data/seed_3d.dgn +0 -0
- pyogrio/gdal_data/stateplane.csv +259 -0
- pyogrio/gdal_data/tms_LINZAntarticaMapTileGrid.json +190 -0
- pyogrio/gdal_data/tms_MapML_APSTILE.json +268 -0
- pyogrio/gdal_data/tms_MapML_CBMTILE.json +346 -0
- pyogrio/gdal_data/tms_NZTM2000.json +243 -0
- pyogrio/gdal_data/trailer.dxf +434 -0
- pyogrio/gdal_data/usage +4 -0
- pyogrio/gdal_data/vcpkg-cmake-wrapper.cmake +23 -0
- pyogrio/gdal_data/vcpkg.spdx.json +264 -0
- pyogrio/gdal_data/vcpkg_abi_info.txt +42 -0
- pyogrio/gdal_data/vdv452.xml +367 -0
- pyogrio/gdal_data/vdv452.xsd +63 -0
- pyogrio/gdal_data/vicar.json +164 -0
- pyogrio/geopandas.py +683 -0
- pyogrio/proj_data/CH +22 -0
- pyogrio/proj_data/GL27 +23 -0
- pyogrio/proj_data/ITRF2000 +24 -0
- pyogrio/proj_data/ITRF2008 +94 -0
- pyogrio/proj_data/ITRF2014 +55 -0
- pyogrio/proj_data/copyright +34 -0
- pyogrio/proj_data/deformation_model.schema.json +582 -0
- pyogrio/proj_data/nad.lst +142 -0
- pyogrio/proj_data/nad27 +810 -0
- pyogrio/proj_data/nad83 +745 -0
- pyogrio/proj_data/other.extra +53 -0
- pyogrio/proj_data/proj-config-version.cmake +44 -0
- pyogrio/proj_data/proj-config.cmake +79 -0
- pyogrio/proj_data/proj-targets-release.cmake +19 -0
- pyogrio/proj_data/proj-targets.cmake +105 -0
- pyogrio/proj_data/proj.db +0 -0
- pyogrio/proj_data/proj.ini +51 -0
- pyogrio/proj_data/proj4-targets-release.cmake +19 -0
- pyogrio/proj_data/proj4-targets.cmake +105 -0
- pyogrio/proj_data/projjson.schema.json +1174 -0
- pyogrio/proj_data/triangulation.schema.json +214 -0
- pyogrio/proj_data/usage +4 -0
- pyogrio/proj_data/vcpkg.spdx.json +198 -0
- pyogrio/proj_data/vcpkg_abi_info.txt +28 -0
- pyogrio/proj_data/world +214 -0
- pyogrio/raw.py +887 -0
- pyogrio/tests/__init__.py +0 -0
- pyogrio/tests/conftest.py +398 -0
- pyogrio/tests/fixtures/README.md +108 -0
- pyogrio/tests/fixtures/curve.gpkg +0 -0
- pyogrio/tests/fixtures/curvepolygon.gpkg +0 -0
- pyogrio/tests/fixtures/line_zm.gpkg +0 -0
- pyogrio/tests/fixtures/multisurface.gpkg +0 -0
- pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.cpg +1 -0
- pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.dbf +0 -0
- pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.prj +1 -0
- pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.shp +0 -0
- pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.shx +0 -0
- pyogrio/tests/fixtures/sample.osm.pbf +0 -0
- pyogrio/tests/fixtures/test_gpkg_nulls.gpkg +0 -0
- pyogrio/tests/test_arrow.py +1195 -0
- pyogrio/tests/test_core.py +678 -0
- pyogrio/tests/test_geopandas_io.py +2314 -0
- pyogrio/tests/test_path.py +364 -0
- pyogrio/tests/test_raw_io.py +1515 -0
- pyogrio/tests/test_util.py +56 -0
- pyogrio/util.py +247 -0
- pyogrio-0.10.0.dist-info/DELVEWHEEL +2 -0
- pyogrio-0.10.0.dist-info/LICENSE +21 -0
- pyogrio-0.10.0.dist-info/METADATA +129 -0
- pyogrio-0.10.0.dist-info/RECORD +246 -0
- pyogrio-0.10.0.dist-info/WHEEL +5 -0
- pyogrio-0.10.0.dist-info/top_level.txt +1 -0
- pyogrio.libs/Lerc-089e3fef3df84b17326dcddbf1dedaa4.dll +0 -0
- pyogrio.libs/gdal-debee5933f0da7bb90b4bcd009023377.dll +0 -0
- pyogrio.libs/geos-ace4c5b5c1f569bb4213e7bbd0b0322e.dll +0 -0
- pyogrio.libs/geos_c-7478ca0a86136b280d9b2d245c6f6627.dll +0 -0
- pyogrio.libs/geotiff-c8fe8a095520a4ea4e465d27e06add3a.dll +0 -0
- pyogrio.libs/iconv-2-27352d156a5467ca5383d3951093ea5a.dll +0 -0
- pyogrio.libs/jpeg62-e56b6f95a95af498f4623b8da4cebd46.dll +0 -0
- pyogrio.libs/json-c-c84940e2654a4f8468bfcf2ce992aa93.dll +0 -0
- pyogrio.libs/libcurl-d69cfd4ad487d53d58743b6778ec85e7.dll +0 -0
- pyogrio.libs/libexpat-6576a8d02641b6a3dbad35901ec200a7.dll +0 -0
- pyogrio.libs/liblzma-9ee4accb476ec1ae24e924953140273d.dll +0 -0
- pyogrio.libs/libpng16-7c36142dda59f186f6bb683e8dae2bfe.dll +0 -0
- pyogrio.libs/msvcp140-98b3e5b80de1e5e9d1703b786d795623.dll +0 -0
- pyogrio.libs/proj-a408c5327f3fd2f5fabe8c56815beed7.dll +0 -0
- pyogrio.libs/qhull_r-516897f855568caab1ab1fe37912766c.dll +0 -0
- pyogrio.libs/sqlite3-9bc109d8536d5ed9666332fec94485fc.dll +0 -0
- pyogrio.libs/tiff-9b3f605fffe0bccc0a964c374ee4f820.dll +0 -0
- pyogrio.libs/zlib1-e5af16a15c63f05bd82d90396807ae5b.dll +0 -0
pyogrio/__init__.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""Vectorized vector I/O using OGR."""
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# start delvewheel patch
|
|
5
|
+
def _delvewheel_patch_1_8_2():
|
|
6
|
+
import os
|
|
7
|
+
libs_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 'pyogrio.libs'))
|
|
8
|
+
if os.path.isdir(libs_dir):
|
|
9
|
+
os.add_dll_directory(libs_dir)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
_delvewheel_patch_1_8_2()
|
|
13
|
+
del _delvewheel_patch_1_8_2
|
|
14
|
+
# end delvewheel patch
|
|
15
|
+
|
|
16
|
+
try:
|
|
17
|
+
# we try importing shapely, to ensure it is imported (and it can load its
|
|
18
|
+
# own GEOS copy) before we load GDAL and its linked GEOS
|
|
19
|
+
import shapely
|
|
20
|
+
import shapely.geos # noqa: F401
|
|
21
|
+
except Exception:
|
|
22
|
+
pass
|
|
23
|
+
|
|
24
|
+
from pyogrio._version import get_versions
|
|
25
|
+
from pyogrio.core import (
|
|
26
|
+
__gdal_geos_version__,
|
|
27
|
+
__gdal_version__,
|
|
28
|
+
__gdal_version_string__,
|
|
29
|
+
detect_write_driver,
|
|
30
|
+
get_gdal_config_option,
|
|
31
|
+
get_gdal_data_path,
|
|
32
|
+
list_drivers,
|
|
33
|
+
list_layers,
|
|
34
|
+
read_bounds,
|
|
35
|
+
read_info,
|
|
36
|
+
set_gdal_config_options,
|
|
37
|
+
vsi_listtree,
|
|
38
|
+
vsi_rmtree,
|
|
39
|
+
vsi_unlink,
|
|
40
|
+
)
|
|
41
|
+
from pyogrio.geopandas import read_dataframe, write_dataframe
|
|
42
|
+
from pyogrio.raw import open_arrow, read_arrow, write_arrow
|
|
43
|
+
|
|
44
|
+
__version__ = get_versions()["version"]
|
|
45
|
+
del get_versions
|
|
46
|
+
|
|
47
|
+
__all__ = [
|
|
48
|
+
"list_drivers",
|
|
49
|
+
"detect_write_driver",
|
|
50
|
+
"list_layers",
|
|
51
|
+
"read_bounds",
|
|
52
|
+
"read_info",
|
|
53
|
+
"set_gdal_config_options",
|
|
54
|
+
"get_gdal_config_option",
|
|
55
|
+
"get_gdal_data_path",
|
|
56
|
+
"open_arrow",
|
|
57
|
+
"read_arrow",
|
|
58
|
+
"read_dataframe",
|
|
59
|
+
"vsi_listtree",
|
|
60
|
+
"vsi_rmtree",
|
|
61
|
+
"vsi_unlink",
|
|
62
|
+
"write_arrow",
|
|
63
|
+
"write_dataframe",
|
|
64
|
+
"__gdal_version__",
|
|
65
|
+
"__gdal_version_string__",
|
|
66
|
+
"__gdal_geos_version__",
|
|
67
|
+
"__version__",
|
|
68
|
+
]
|
pyogrio/_compat.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from packaging.version import Version
|
|
2
|
+
|
|
3
|
+
from pyogrio.core import __gdal_geos_version__, __gdal_version__
|
|
4
|
+
|
|
5
|
+
# detect optional dependencies
|
|
6
|
+
try:
|
|
7
|
+
import pyarrow
|
|
8
|
+
except ImportError:
|
|
9
|
+
pyarrow = None
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
import pyproj
|
|
13
|
+
except ImportError:
|
|
14
|
+
pyproj = None
|
|
15
|
+
|
|
16
|
+
try:
|
|
17
|
+
import shapely
|
|
18
|
+
except ImportError:
|
|
19
|
+
shapely = None
|
|
20
|
+
|
|
21
|
+
try:
|
|
22
|
+
import geopandas
|
|
23
|
+
except ImportError:
|
|
24
|
+
geopandas = None
|
|
25
|
+
|
|
26
|
+
try:
|
|
27
|
+
import pandas
|
|
28
|
+
except ImportError:
|
|
29
|
+
pandas = None
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
HAS_ARROW_API = __gdal_version__ >= (3, 6, 0)
|
|
33
|
+
HAS_ARROW_WRITE_API = __gdal_version__ >= (3, 8, 0)
|
|
34
|
+
HAS_PYARROW = pyarrow is not None
|
|
35
|
+
HAS_PYPROJ = pyproj is not None
|
|
36
|
+
|
|
37
|
+
HAS_GEOPANDAS = geopandas is not None
|
|
38
|
+
|
|
39
|
+
PANDAS_GE_15 = pandas is not None and Version(pandas.__version__) >= Version("1.5.0")
|
|
40
|
+
PANDAS_GE_20 = pandas is not None and Version(pandas.__version__) >= Version("2.0.0")
|
|
41
|
+
PANDAS_GE_22 = pandas is not None and Version(pandas.__version__) >= Version("2.2.0")
|
|
42
|
+
|
|
43
|
+
GDAL_GE_38 = __gdal_version__ >= (3, 8, 0)
|
|
44
|
+
|
|
45
|
+
HAS_GDAL_GEOS = __gdal_geos_version__ is not None
|
|
46
|
+
|
|
47
|
+
HAS_SHAPELY = shapely is not None and Version(shapely.__version__) >= Version("2.0.0")
|
pyogrio/_env.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# With Python >= 3.8 on Windows directories in PATH are not automatically
|
|
2
|
+
# searched for DLL dependencies and must be added manually with
|
|
3
|
+
# os.add_dll_directory.
|
|
4
|
+
# adapted from Fiona: https://github.com/Toblerity/Fiona/pull/875
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
import logging
|
|
8
|
+
import os
|
|
9
|
+
import platform
|
|
10
|
+
from contextlib import contextmanager
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
log = logging.getLogger(__name__)
|
|
14
|
+
log.addHandler(logging.NullHandler())
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
try:
|
|
18
|
+
# set GDAL_CURL_CA_BUNDLE / PROJ_CURL_CA_BUNDLE for GDAL >= 3.2
|
|
19
|
+
import certifi
|
|
20
|
+
|
|
21
|
+
ca_bundle = certifi.where()
|
|
22
|
+
os.environ.setdefault("GDAL_CURL_CA_BUNDLE", ca_bundle)
|
|
23
|
+
os.environ.setdefault("PROJ_CURL_CA_BUNDLE", ca_bundle)
|
|
24
|
+
except ImportError:
|
|
25
|
+
pass
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
gdal_dll_dir = None
|
|
29
|
+
|
|
30
|
+
if platform.system() == "Windows":
|
|
31
|
+
# if loading of extension modules fails, search for gdal dll directory
|
|
32
|
+
try:
|
|
33
|
+
import pyogrio._io # noqa: F401
|
|
34
|
+
|
|
35
|
+
except ImportError:
|
|
36
|
+
for path in os.getenv("PATH", "").split(os.pathsep):
|
|
37
|
+
if list(Path(path).glob("gdal*.dll")):
|
|
38
|
+
log.info(f"Found GDAL at {path}")
|
|
39
|
+
gdal_dll_dir = path
|
|
40
|
+
break
|
|
41
|
+
|
|
42
|
+
if not gdal_dll_dir:
|
|
43
|
+
raise ImportError(
|
|
44
|
+
"GDAL DLL could not be found. It must be on the system PATH."
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@contextmanager
|
|
49
|
+
def GDALEnv():
|
|
50
|
+
dll_dir = None
|
|
51
|
+
|
|
52
|
+
if gdal_dll_dir:
|
|
53
|
+
dll_dir = os.add_dll_directory(gdal_dll_dir)
|
|
54
|
+
|
|
55
|
+
try:
|
|
56
|
+
yield None
|
|
57
|
+
finally:
|
|
58
|
+
if dll_dir is not None:
|
|
59
|
+
dll_dir.close()
|