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.

Files changed (246) hide show
  1. pyogrio/__init__.py +68 -0
  2. pyogrio/_compat.py +47 -0
  3. pyogrio/_env.py +59 -0
  4. pyogrio/_err.c +11520 -0
  5. pyogrio/_err.cp313-win_amd64.pyd +0 -0
  6. pyogrio/_geometry.c +8157 -0
  7. pyogrio/_geometry.cp313-win_amd64.pyd +0 -0
  8. pyogrio/_io.c +68161 -0
  9. pyogrio/_io.cp313-win_amd64.pyd +0 -0
  10. pyogrio/_ogr.c +14826 -0
  11. pyogrio/_ogr.cp313-win_amd64.pyd +0 -0
  12. pyogrio/_version.py +21 -0
  13. pyogrio/_vsi.c +11871 -0
  14. pyogrio/_vsi.cp313-win_amd64.pyd +0 -0
  15. pyogrio/core.py +386 -0
  16. pyogrio/errors.py +25 -0
  17. pyogrio/gdal_data/GDAL-targets-release.cmake +20 -0
  18. pyogrio/gdal_data/GDAL-targets.cmake +105 -0
  19. pyogrio/gdal_data/GDALConfig.cmake +23 -0
  20. pyogrio/gdal_data/GDALConfigVersion.cmake +85 -0
  21. pyogrio/gdal_data/GDALLogoBW.svg +138 -0
  22. pyogrio/gdal_data/GDALLogoColor.svg +126 -0
  23. pyogrio/gdal_data/GDALLogoGS.svg +126 -0
  24. pyogrio/gdal_data/LICENSE.TXT +467 -0
  25. pyogrio/gdal_data/MM_m_idofic.csv +321 -0
  26. pyogrio/gdal_data/copyright +467 -0
  27. pyogrio/gdal_data/cubewerx_extra.wkt +48 -0
  28. pyogrio/gdal_data/default.rsc +0 -0
  29. pyogrio/gdal_data/ecw_cs.wkt +1453 -0
  30. pyogrio/gdal_data/eedaconf.json +23 -0
  31. pyogrio/gdal_data/epsg.wkt +1 -0
  32. pyogrio/gdal_data/esri_StatePlane_extra.wkt +631 -0
  33. pyogrio/gdal_data/gdalicon.png +0 -0
  34. pyogrio/gdal_data/gdalinfo_output.schema.json +346 -0
  35. pyogrio/gdal_data/gdalmdiminfo_output.schema.json +321 -0
  36. pyogrio/gdal_data/gdaltileindex.xsd +269 -0
  37. pyogrio/gdal_data/gdalvrt.xsd +880 -0
  38. pyogrio/gdal_data/gfs.xsd +246 -0
  39. pyogrio/gdal_data/gml_registry.xml +117 -0
  40. pyogrio/gdal_data/gml_registry.xsd +66 -0
  41. pyogrio/gdal_data/grib2_center.csv +251 -0
  42. pyogrio/gdal_data/grib2_process.csv +102 -0
  43. pyogrio/gdal_data/grib2_subcenter.csv +63 -0
  44. pyogrio/gdal_data/grib2_table_4_2_0_0.csv +261 -0
  45. pyogrio/gdal_data/grib2_table_4_2_0_1.csv +261 -0
  46. pyogrio/gdal_data/grib2_table_4_2_0_13.csv +261 -0
  47. pyogrio/gdal_data/grib2_table_4_2_0_14.csv +261 -0
  48. pyogrio/gdal_data/grib2_table_4_2_0_15.csv +261 -0
  49. pyogrio/gdal_data/grib2_table_4_2_0_16.csv +261 -0
  50. pyogrio/gdal_data/grib2_table_4_2_0_17.csv +11 -0
  51. pyogrio/gdal_data/grib2_table_4_2_0_18.csv +261 -0
  52. pyogrio/gdal_data/grib2_table_4_2_0_19.csv +261 -0
  53. pyogrio/gdal_data/grib2_table_4_2_0_190.csv +261 -0
  54. pyogrio/gdal_data/grib2_table_4_2_0_191.csv +261 -0
  55. pyogrio/gdal_data/grib2_table_4_2_0_2.csv +261 -0
  56. pyogrio/gdal_data/grib2_table_4_2_0_20.csv +261 -0
  57. pyogrio/gdal_data/grib2_table_4_2_0_21.csv +261 -0
  58. pyogrio/gdal_data/grib2_table_4_2_0_3.csv +261 -0
  59. pyogrio/gdal_data/grib2_table_4_2_0_4.csv +261 -0
  60. pyogrio/gdal_data/grib2_table_4_2_0_5.csv +261 -0
  61. pyogrio/gdal_data/grib2_table_4_2_0_6.csv +261 -0
  62. pyogrio/gdal_data/grib2_table_4_2_0_7.csv +261 -0
  63. pyogrio/gdal_data/grib2_table_4_2_10_0.csv +261 -0
  64. pyogrio/gdal_data/grib2_table_4_2_10_1.csv +261 -0
  65. pyogrio/gdal_data/grib2_table_4_2_10_191.csv +261 -0
  66. pyogrio/gdal_data/grib2_table_4_2_10_2.csv +261 -0
  67. pyogrio/gdal_data/grib2_table_4_2_10_3.csv +261 -0
  68. pyogrio/gdal_data/grib2_table_4_2_10_4.csv +261 -0
  69. pyogrio/gdal_data/grib2_table_4_2_1_0.csv +261 -0
  70. pyogrio/gdal_data/grib2_table_4_2_1_1.csv +261 -0
  71. pyogrio/gdal_data/grib2_table_4_2_1_2.csv +261 -0
  72. pyogrio/gdal_data/grib2_table_4_2_20_0.csv +261 -0
  73. pyogrio/gdal_data/grib2_table_4_2_20_1.csv +261 -0
  74. pyogrio/gdal_data/grib2_table_4_2_20_2.csv +261 -0
  75. pyogrio/gdal_data/grib2_table_4_2_2_0.csv +261 -0
  76. pyogrio/gdal_data/grib2_table_4_2_2_3.csv +261 -0
  77. pyogrio/gdal_data/grib2_table_4_2_2_4.csv +261 -0
  78. pyogrio/gdal_data/grib2_table_4_2_2_5.csv +261 -0
  79. pyogrio/gdal_data/grib2_table_4_2_2_6.csv +261 -0
  80. pyogrio/gdal_data/grib2_table_4_2_3_0.csv +261 -0
  81. pyogrio/gdal_data/grib2_table_4_2_3_1.csv +261 -0
  82. pyogrio/gdal_data/grib2_table_4_2_3_2.csv +28 -0
  83. pyogrio/gdal_data/grib2_table_4_2_3_3.csv +8 -0
  84. pyogrio/gdal_data/grib2_table_4_2_3_4.csv +14 -0
  85. pyogrio/gdal_data/grib2_table_4_2_3_5.csv +11 -0
  86. pyogrio/gdal_data/grib2_table_4_2_3_6.csv +11 -0
  87. pyogrio/gdal_data/grib2_table_4_2_4_0.csv +261 -0
  88. pyogrio/gdal_data/grib2_table_4_2_4_1.csv +261 -0
  89. pyogrio/gdal_data/grib2_table_4_2_4_10.csv +261 -0
  90. pyogrio/gdal_data/grib2_table_4_2_4_2.csv +261 -0
  91. pyogrio/gdal_data/grib2_table_4_2_4_3.csv +261 -0
  92. pyogrio/gdal_data/grib2_table_4_2_4_4.csv +261 -0
  93. pyogrio/gdal_data/grib2_table_4_2_4_5.csv +261 -0
  94. pyogrio/gdal_data/grib2_table_4_2_4_6.csv +261 -0
  95. pyogrio/gdal_data/grib2_table_4_2_4_7.csv +261 -0
  96. pyogrio/gdal_data/grib2_table_4_2_4_8.csv +261 -0
  97. pyogrio/gdal_data/grib2_table_4_2_4_9.csv +261 -0
  98. pyogrio/gdal_data/grib2_table_4_2_local_Canada.csv +5 -0
  99. pyogrio/gdal_data/grib2_table_4_2_local_HPC.csv +2 -0
  100. pyogrio/gdal_data/grib2_table_4_2_local_MRMS.csv +175 -0
  101. pyogrio/gdal_data/grib2_table_4_2_local_NCEP.csv +401 -0
  102. pyogrio/gdal_data/grib2_table_4_2_local_NDFD.csv +38 -0
  103. pyogrio/gdal_data/grib2_table_4_2_local_index.csv +7 -0
  104. pyogrio/gdal_data/grib2_table_4_5.csv +261 -0
  105. pyogrio/gdal_data/grib2_table_versions.csv +3 -0
  106. pyogrio/gdal_data/gt_datum.csv +229 -0
  107. pyogrio/gdal_data/gt_ellips.csv +24 -0
  108. pyogrio/gdal_data/header.dxf +1124 -0
  109. pyogrio/gdal_data/inspire_cp_BasicPropertyUnit.gfs +57 -0
  110. pyogrio/gdal_data/inspire_cp_CadastralBoundary.gfs +60 -0
  111. pyogrio/gdal_data/inspire_cp_CadastralParcel.gfs +81 -0
  112. pyogrio/gdal_data/inspire_cp_CadastralZoning.gfs +161 -0
  113. pyogrio/gdal_data/jpfgdgml_AdmArea.gfs +59 -0
  114. pyogrio/gdal_data/jpfgdgml_AdmBdry.gfs +49 -0
  115. pyogrio/gdal_data/jpfgdgml_AdmPt.gfs +59 -0
  116. pyogrio/gdal_data/jpfgdgml_BldA.gfs +54 -0
  117. pyogrio/gdal_data/jpfgdgml_BldL.gfs +54 -0
  118. pyogrio/gdal_data/jpfgdgml_Cntr.gfs +54 -0
  119. pyogrio/gdal_data/jpfgdgml_CommBdry.gfs +49 -0
  120. pyogrio/gdal_data/jpfgdgml_CommPt.gfs +59 -0
  121. pyogrio/gdal_data/jpfgdgml_Cstline.gfs +54 -0
  122. pyogrio/gdal_data/jpfgdgml_ElevPt.gfs +54 -0
  123. pyogrio/gdal_data/jpfgdgml_GCP.gfs +94 -0
  124. pyogrio/gdal_data/jpfgdgml_LeveeEdge.gfs +49 -0
  125. pyogrio/gdal_data/jpfgdgml_RailCL.gfs +54 -0
  126. pyogrio/gdal_data/jpfgdgml_RdASL.gfs +44 -0
  127. pyogrio/gdal_data/jpfgdgml_RdArea.gfs +54 -0
  128. pyogrio/gdal_data/jpfgdgml_RdCompt.gfs +59 -0
  129. pyogrio/gdal_data/jpfgdgml_RdEdg.gfs +59 -0
  130. pyogrio/gdal_data/jpfgdgml_RdMgtBdry.gfs +49 -0
  131. pyogrio/gdal_data/jpfgdgml_RdSgmtA.gfs +59 -0
  132. pyogrio/gdal_data/jpfgdgml_RvrMgtBdry.gfs +49 -0
  133. pyogrio/gdal_data/jpfgdgml_SBAPt.gfs +49 -0
  134. pyogrio/gdal_data/jpfgdgml_SBArea.gfs +54 -0
  135. pyogrio/gdal_data/jpfgdgml_SBBdry.gfs +44 -0
  136. pyogrio/gdal_data/jpfgdgml_WA.gfs +54 -0
  137. pyogrio/gdal_data/jpfgdgml_WL.gfs +54 -0
  138. pyogrio/gdal_data/jpfgdgml_WStrA.gfs +54 -0
  139. pyogrio/gdal_data/jpfgdgml_WStrL.gfs +54 -0
  140. pyogrio/gdal_data/nitf_spec.xml +3306 -0
  141. pyogrio/gdal_data/nitf_spec.xsd +189 -0
  142. pyogrio/gdal_data/ogrinfo_output.schema.json +528 -0
  143. pyogrio/gdal_data/ogrvrt.xsd +546 -0
  144. pyogrio/gdal_data/osmconf.ini +132 -0
  145. pyogrio/gdal_data/ozi_datum.csv +131 -0
  146. pyogrio/gdal_data/ozi_ellips.csv +35 -0
  147. pyogrio/gdal_data/pci_datum.txt +530 -0
  148. pyogrio/gdal_data/pci_ellips.txt +129 -0
  149. pyogrio/gdal_data/pdfcomposition.xsd +721 -0
  150. pyogrio/gdal_data/pds4_template.xml +65 -0
  151. pyogrio/gdal_data/plscenesconf.json +1985 -0
  152. pyogrio/gdal_data/ruian_vf_ob_v1.gfs +1455 -0
  153. pyogrio/gdal_data/ruian_vf_st_uvoh_v1.gfs +86 -0
  154. pyogrio/gdal_data/ruian_vf_st_v1.gfs +1489 -0
  155. pyogrio/gdal_data/ruian_vf_v1.gfs +2126 -0
  156. pyogrio/gdal_data/s57agencies.csv +249 -0
  157. pyogrio/gdal_data/s57attributes.csv +484 -0
  158. pyogrio/gdal_data/s57expectedinput.csv +1008 -0
  159. pyogrio/gdal_data/s57objectclasses.csv +287 -0
  160. pyogrio/gdal_data/seed_2d.dgn +0 -0
  161. pyogrio/gdal_data/seed_3d.dgn +0 -0
  162. pyogrio/gdal_data/stateplane.csv +259 -0
  163. pyogrio/gdal_data/tms_LINZAntarticaMapTileGrid.json +190 -0
  164. pyogrio/gdal_data/tms_MapML_APSTILE.json +268 -0
  165. pyogrio/gdal_data/tms_MapML_CBMTILE.json +346 -0
  166. pyogrio/gdal_data/tms_NZTM2000.json +243 -0
  167. pyogrio/gdal_data/trailer.dxf +434 -0
  168. pyogrio/gdal_data/usage +4 -0
  169. pyogrio/gdal_data/vcpkg-cmake-wrapper.cmake +23 -0
  170. pyogrio/gdal_data/vcpkg.spdx.json +264 -0
  171. pyogrio/gdal_data/vcpkg_abi_info.txt +42 -0
  172. pyogrio/gdal_data/vdv452.xml +367 -0
  173. pyogrio/gdal_data/vdv452.xsd +63 -0
  174. pyogrio/gdal_data/vicar.json +164 -0
  175. pyogrio/geopandas.py +683 -0
  176. pyogrio/proj_data/CH +22 -0
  177. pyogrio/proj_data/GL27 +23 -0
  178. pyogrio/proj_data/ITRF2000 +24 -0
  179. pyogrio/proj_data/ITRF2008 +94 -0
  180. pyogrio/proj_data/ITRF2014 +55 -0
  181. pyogrio/proj_data/copyright +34 -0
  182. pyogrio/proj_data/deformation_model.schema.json +582 -0
  183. pyogrio/proj_data/nad.lst +142 -0
  184. pyogrio/proj_data/nad27 +810 -0
  185. pyogrio/proj_data/nad83 +745 -0
  186. pyogrio/proj_data/other.extra +53 -0
  187. pyogrio/proj_data/proj-config-version.cmake +44 -0
  188. pyogrio/proj_data/proj-config.cmake +79 -0
  189. pyogrio/proj_data/proj-targets-release.cmake +19 -0
  190. pyogrio/proj_data/proj-targets.cmake +105 -0
  191. pyogrio/proj_data/proj.db +0 -0
  192. pyogrio/proj_data/proj.ini +51 -0
  193. pyogrio/proj_data/proj4-targets-release.cmake +19 -0
  194. pyogrio/proj_data/proj4-targets.cmake +105 -0
  195. pyogrio/proj_data/projjson.schema.json +1174 -0
  196. pyogrio/proj_data/triangulation.schema.json +214 -0
  197. pyogrio/proj_data/usage +4 -0
  198. pyogrio/proj_data/vcpkg.spdx.json +198 -0
  199. pyogrio/proj_data/vcpkg_abi_info.txt +28 -0
  200. pyogrio/proj_data/world +214 -0
  201. pyogrio/raw.py +887 -0
  202. pyogrio/tests/__init__.py +0 -0
  203. pyogrio/tests/conftest.py +398 -0
  204. pyogrio/tests/fixtures/README.md +108 -0
  205. pyogrio/tests/fixtures/curve.gpkg +0 -0
  206. pyogrio/tests/fixtures/curvepolygon.gpkg +0 -0
  207. pyogrio/tests/fixtures/line_zm.gpkg +0 -0
  208. pyogrio/tests/fixtures/multisurface.gpkg +0 -0
  209. pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.cpg +1 -0
  210. pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.dbf +0 -0
  211. pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.prj +1 -0
  212. pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.shp +0 -0
  213. pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.shx +0 -0
  214. pyogrio/tests/fixtures/sample.osm.pbf +0 -0
  215. pyogrio/tests/fixtures/test_gpkg_nulls.gpkg +0 -0
  216. pyogrio/tests/test_arrow.py +1195 -0
  217. pyogrio/tests/test_core.py +678 -0
  218. pyogrio/tests/test_geopandas_io.py +2314 -0
  219. pyogrio/tests/test_path.py +364 -0
  220. pyogrio/tests/test_raw_io.py +1515 -0
  221. pyogrio/tests/test_util.py +56 -0
  222. pyogrio/util.py +247 -0
  223. pyogrio-0.10.0.dist-info/DELVEWHEEL +2 -0
  224. pyogrio-0.10.0.dist-info/LICENSE +21 -0
  225. pyogrio-0.10.0.dist-info/METADATA +129 -0
  226. pyogrio-0.10.0.dist-info/RECORD +246 -0
  227. pyogrio-0.10.0.dist-info/WHEEL +5 -0
  228. pyogrio-0.10.0.dist-info/top_level.txt +1 -0
  229. pyogrio.libs/Lerc-089e3fef3df84b17326dcddbf1dedaa4.dll +0 -0
  230. pyogrio.libs/gdal-debee5933f0da7bb90b4bcd009023377.dll +0 -0
  231. pyogrio.libs/geos-ace4c5b5c1f569bb4213e7bbd0b0322e.dll +0 -0
  232. pyogrio.libs/geos_c-7478ca0a86136b280d9b2d245c6f6627.dll +0 -0
  233. pyogrio.libs/geotiff-c8fe8a095520a4ea4e465d27e06add3a.dll +0 -0
  234. pyogrio.libs/iconv-2-27352d156a5467ca5383d3951093ea5a.dll +0 -0
  235. pyogrio.libs/jpeg62-e56b6f95a95af498f4623b8da4cebd46.dll +0 -0
  236. pyogrio.libs/json-c-c84940e2654a4f8468bfcf2ce992aa93.dll +0 -0
  237. pyogrio.libs/libcurl-d69cfd4ad487d53d58743b6778ec85e7.dll +0 -0
  238. pyogrio.libs/libexpat-6576a8d02641b6a3dbad35901ec200a7.dll +0 -0
  239. pyogrio.libs/liblzma-9ee4accb476ec1ae24e924953140273d.dll +0 -0
  240. pyogrio.libs/libpng16-7c36142dda59f186f6bb683e8dae2bfe.dll +0 -0
  241. pyogrio.libs/msvcp140-98b3e5b80de1e5e9d1703b786d795623.dll +0 -0
  242. pyogrio.libs/proj-a408c5327f3fd2f5fabe8c56815beed7.dll +0 -0
  243. pyogrio.libs/qhull_r-516897f855568caab1ab1fe37912766c.dll +0 -0
  244. pyogrio.libs/sqlite3-9bc109d8536d5ed9666332fec94485fc.dll +0 -0
  245. pyogrio.libs/tiff-9b3f605fffe0bccc0a964c374ee4f820.dll +0 -0
  246. pyogrio.libs/zlib1-e5af16a15c63f05bd82d90396807ae5b.dll +0 -0
Binary file
pyogrio/core.py ADDED
@@ -0,0 +1,386 @@
1
+ """Core functions to interact with OGR data sources."""
2
+
3
+ from pathlib import Path
4
+ from typing import Optional, Union
5
+
6
+ from pyogrio._env import GDALEnv
7
+ from pyogrio.util import (
8
+ _mask_to_wkb,
9
+ _preprocess_options_key_value,
10
+ get_vsi_path_or_buffer,
11
+ )
12
+
13
+ with GDALEnv():
14
+ from pyogrio._err import _register_error_handler
15
+ from pyogrio._io import ogr_list_layers, ogr_read_bounds, ogr_read_info
16
+ from pyogrio._ogr import (
17
+ _get_drivers_for_path,
18
+ _register_drivers,
19
+ get_gdal_config_option as _get_gdal_config_option,
20
+ get_gdal_data_path as _get_gdal_data_path,
21
+ get_gdal_geos_version,
22
+ get_gdal_version,
23
+ get_gdal_version_string,
24
+ init_gdal_data as _init_gdal_data,
25
+ init_proj_data as _init_proj_data,
26
+ ogr_list_drivers,
27
+ set_gdal_config_options as _set_gdal_config_options,
28
+ )
29
+ from pyogrio._vsi import (
30
+ ogr_vsi_listtree,
31
+ ogr_vsi_rmtree,
32
+ ogr_vsi_unlink,
33
+ )
34
+
35
+ _init_gdal_data()
36
+ _init_proj_data()
37
+ _register_drivers()
38
+ _register_error_handler()
39
+
40
+ __gdal_version__ = get_gdal_version()
41
+ __gdal_version_string__ = get_gdal_version_string()
42
+ __gdal_geos_version__ = get_gdal_geos_version()
43
+
44
+
45
+ def list_drivers(read=False, write=False):
46
+ """List drivers available in GDAL.
47
+
48
+ Parameters
49
+ ----------
50
+ read: bool, optional (default: False)
51
+ If True, will only return drivers that are known to support read capabilities.
52
+ write: bool, optional (default: False)
53
+ If True, will only return drivers that are known to support write capabilities.
54
+
55
+ Returns
56
+ -------
57
+ dict
58
+ Mapping of driver name to file mode capabilities: ``"r"``: read, ``"w"``: write.
59
+ Drivers that are available but with unknown support are marked with ``"?"``
60
+
61
+ """
62
+ drivers = ogr_list_drivers()
63
+
64
+ if read:
65
+ drivers = {k: v for k, v in drivers.items() if v.startswith("r")}
66
+
67
+ if write:
68
+ drivers = {k: v for k, v in drivers.items() if v.endswith("w")}
69
+
70
+ return drivers
71
+
72
+
73
+ def detect_write_driver(path):
74
+ """Attempt to infer the driver for a path by extension or prefix.
75
+
76
+ Only drivers that support write capabilities will be detected.
77
+
78
+ If the path cannot be resolved to a single driver, a ValueError will be
79
+ raised.
80
+
81
+ Parameters
82
+ ----------
83
+ path : str
84
+ data source path
85
+
86
+ Returns
87
+ -------
88
+ str
89
+ name of the driver, if detected
90
+
91
+ """
92
+ # try to infer driver from path
93
+ drivers = _get_drivers_for_path(path)
94
+
95
+ if len(drivers) == 0:
96
+ raise ValueError(
97
+ f"Could not infer driver from path: {path}; please specify driver "
98
+ "explicitly"
99
+ )
100
+
101
+ # if there are multiple drivers detected, user needs to specify the correct
102
+ # one manually
103
+ elif len(drivers) > 1:
104
+ raise ValueError(
105
+ f"Could not infer driver from path: {path}; multiple drivers are "
106
+ f"available for that extension: {', '.join(drivers)}. Please "
107
+ "specify driver explicitly."
108
+ )
109
+
110
+ return drivers[0]
111
+
112
+
113
+ def list_layers(path_or_buffer, /):
114
+ """List layers available in an OGR data source.
115
+
116
+ NOTE: includes both spatial and nonspatial layers.
117
+
118
+ Parameters
119
+ ----------
120
+ path_or_buffer : str, pathlib.Path, bytes, or file-like
121
+ A dataset path or URI, raw buffer, or file-like object with a read method.
122
+
123
+ Returns
124
+ -------
125
+ ndarray shape (2, n)
126
+ array of pairs of [<layer name>, <layer geometry type>]
127
+ Note: geometry is `None` for nonspatial layers.
128
+
129
+ """
130
+ return ogr_list_layers(get_vsi_path_or_buffer(path_or_buffer))
131
+
132
+
133
+ def read_bounds(
134
+ path_or_buffer,
135
+ /,
136
+ layer=None,
137
+ skip_features=0,
138
+ max_features=None,
139
+ where=None,
140
+ bbox=None,
141
+ mask=None,
142
+ ):
143
+ """Read bounds of each feature.
144
+
145
+ This can be used to assist with spatial indexing and partitioning, in
146
+ order to avoid reading all features into memory. It is roughly 2-3x faster
147
+ than reading the full geometry and attributes of a dataset.
148
+
149
+ Parameters
150
+ ----------
151
+ path_or_buffer : str, pathlib.Path, bytes, or file-like
152
+ A dataset path or URI, raw buffer, or file-like object with a read method.
153
+ layer : int or str, optional (default: first layer)
154
+ If an integer is provided, it corresponds to the index of the layer
155
+ with the data source. If a string is provided, it must match the name
156
+ of the layer in the data source. Defaults to first layer in data source.
157
+ skip_features : int, optional (default: 0)
158
+ Number of features to skip from the beginning of the file before returning
159
+ features. Must be less than the total number of features in the file.
160
+ max_features : int, optional (default: None)
161
+ Number of features to read from the file. Must be less than the total
162
+ number of features in the file minus ``skip_features`` (if used).
163
+ where : str, optional (default: None)
164
+ Where clause to filter features in layer by attribute values. Uses a
165
+ restricted form of SQL WHERE clause, defined here:
166
+ http://ogdi.sourceforge.net/prop/6.2.CapabilitiesMetadata.html
167
+ Examples: ``"ISO_A3 = 'CAN'"``, ``"POP_EST > 10000000 AND POP_EST < 100000000"``
168
+ bbox : tuple of (xmin, ymin, xmax, ymax), optional (default: None)
169
+ If present, will be used to filter records whose geometry intersects this
170
+ box. This must be in the same CRS as the dataset. If GEOS is present
171
+ and used by GDAL, only geometries that intersect this bbox will be
172
+ returned; if GEOS is not available or not used by GDAL, all geometries
173
+ with bounding boxes that intersect this bbox will be returned.
174
+ mask : Shapely geometry, optional (default: None)
175
+ If present, will be used to filter records whose geometry intersects
176
+ this geometry. This must be in the same CRS as the dataset. If GEOS is
177
+ present and used by GDAL, only geometries that intersect this geometry
178
+ will be returned; if GEOS is not available or not used by GDAL, all
179
+ geometries with bounding boxes that intersect the bounding box of this
180
+ geometry will be returned. Requires Shapely >= 2.0.
181
+ Cannot be combined with ``bbox`` keyword.
182
+
183
+ Returns
184
+ -------
185
+ tuple of (fids, bounds)
186
+ fids are global IDs read from the FID field of the dataset
187
+ bounds are ndarray of shape(4, n) containing ``xmin``, ``ymin``, ``xmax``,
188
+ ``ymax``
189
+
190
+ """
191
+ return ogr_read_bounds(
192
+ get_vsi_path_or_buffer(path_or_buffer),
193
+ layer=layer,
194
+ skip_features=skip_features,
195
+ max_features=max_features or 0,
196
+ where=where,
197
+ bbox=bbox,
198
+ mask=_mask_to_wkb(mask),
199
+ )
200
+
201
+
202
+ def read_info(
203
+ path_or_buffer,
204
+ /,
205
+ layer=None,
206
+ encoding=None,
207
+ force_feature_count=False,
208
+ force_total_bounds=False,
209
+ **kwargs,
210
+ ):
211
+ """Read information about an OGR data source.
212
+
213
+ ``crs``, ``geometry`` and ``total_bounds`` will be ``None`` and ``features`` will be
214
+ 0 for a nonspatial layer.
215
+
216
+ ``features`` will be -1 if this is an expensive operation for this driver. You can
217
+ force it to be calculated using the ``force_feature_count`` parameter.
218
+
219
+ ``total_bounds`` is the 2-dimensional extent of all features within the dataset:
220
+ (xmin, ymin, xmax, ymax). It will be None if this is an expensive operation for this
221
+ driver or if the data source is nonspatial. You can force it to be calculated using
222
+ the ``force_total_bounds`` parameter.
223
+
224
+ ``fid_column`` is the name of the FID field in the data source, if the FID is
225
+ physically stored (e.g. in GPKG). If the FID is just a sequence, ``fid_column``
226
+ will be "" (e.g. ESRI Shapefile).
227
+
228
+ ``geometry_name`` is the name of the field where the main geometry is stored in the
229
+ data data source, if the field name can by customized (e.g. in GPKG). If no custom
230
+ name is supported, ``geometry_name`` will be "" (e.g. ESRI Shapefile).
231
+
232
+ ``encoding`` will be ``UTF-8`` if either the native encoding is likely to be
233
+ ``UTF-8`` or GDAL can automatically convert from the detected native encoding
234
+ to ``UTF-8``.
235
+
236
+ Parameters
237
+ ----------
238
+ path_or_buffer : str, pathlib.Path, bytes, or file-like
239
+ A dataset path or URI, raw buffer, or file-like object with a read method.
240
+ layer : [type], optional
241
+ Name or index of layer in data source. Reads the first layer by default.
242
+ encoding : [type], optional (default: None)
243
+ If present, will be used as the encoding for reading string values from
244
+ the data source, unless encoding can be inferred directly from the data
245
+ source.
246
+ force_feature_count : bool, optional (default: False)
247
+ True if the feature count should be computed even if it is expensive.
248
+ force_total_bounds : bool, optional (default: False)
249
+ True if the total bounds should be computed even if it is expensive.
250
+ **kwargs
251
+ Additional driver-specific dataset open options passed to OGR. Invalid
252
+ options will trigger a warning.
253
+
254
+ Returns
255
+ -------
256
+ dict
257
+ A dictionary with the following keys::
258
+
259
+ {
260
+ "layer_name": "<layer name>",
261
+ "crs": "<crs>",
262
+ "fields": <ndarray of field names>,
263
+ "dtypes": <ndarray of field dtypes>,
264
+ "encoding": "<encoding>",
265
+ "fid_column": "<fid column name or "">",
266
+ "geometry_name": "<geometry column name or "">",
267
+ "geometry_type": "<geometry type>",
268
+ "features": <feature count or -1>,
269
+ "total_bounds": <tuple with total bounds or None>,
270
+ "driver": "<driver>",
271
+ "capabilities": "<dict of driver capabilities>"
272
+ "dataset_metadata": "<dict of dataset metadata or None>"
273
+ "layer_metadata": "<dict of layer metadata or None>"
274
+ }
275
+
276
+ """
277
+ dataset_kwargs = _preprocess_options_key_value(kwargs) if kwargs else {}
278
+
279
+ return ogr_read_info(
280
+ get_vsi_path_or_buffer(path_or_buffer),
281
+ layer=layer,
282
+ encoding=encoding,
283
+ force_feature_count=force_feature_count,
284
+ force_total_bounds=force_total_bounds,
285
+ dataset_kwargs=dataset_kwargs,
286
+ )
287
+
288
+
289
+ def set_gdal_config_options(options):
290
+ """Set GDAL configuration options.
291
+
292
+ Options are listed here: https://trac.osgeo.org/gdal/wiki/ConfigOptions
293
+
294
+ No error is raised if invalid option names are provided.
295
+
296
+ These options are applied for an entire session rather than for individual
297
+ functions.
298
+
299
+ Parameters
300
+ ----------
301
+ options : dict
302
+ If present, provides a mapping of option name / value pairs for GDAL
303
+ configuration options. ``True`` / ``False`` are normalized to ``'ON'``
304
+ / ``'OFF'``. A value of ``None`` for a config option can be used to clear out a
305
+ previously set value.
306
+
307
+ """
308
+ _set_gdal_config_options(options)
309
+
310
+
311
+ def get_gdal_config_option(name):
312
+ """Get the value for a GDAL configuration option.
313
+
314
+ Parameters
315
+ ----------
316
+ name : str
317
+ name of the option to retrive
318
+
319
+ Returns
320
+ -------
321
+ value of the option or None if not set
322
+ ``'ON'`` / ``'OFF'`` are normalized to ``True`` / ``False``.
323
+
324
+ """
325
+ return _get_gdal_config_option(name)
326
+
327
+
328
+ def get_gdal_data_path():
329
+ """Get the path to the directory GDAL uses to read data files.
330
+
331
+ Returns
332
+ -------
333
+ str, or None if data directory was not found
334
+
335
+ """
336
+ return _get_gdal_data_path()
337
+
338
+
339
+ def vsi_listtree(path: Union[str, Path], pattern: Optional[str] = None):
340
+ """Recursively list the contents of a VSI directory.
341
+
342
+ An fnmatch pattern can be specified to filter the directories/files
343
+ returned.
344
+
345
+ Parameters
346
+ ----------
347
+ path : str or pathlib.Path
348
+ Path to the VSI directory to be listed.
349
+ pattern : str, optional
350
+ Pattern to filter results, in fnmatch format.
351
+
352
+ """
353
+ if isinstance(path, Path):
354
+ path = path.as_posix()
355
+
356
+ return ogr_vsi_listtree(path, pattern=pattern)
357
+
358
+
359
+ def vsi_rmtree(path: Union[str, Path]):
360
+ """Recursively remove VSI directory.
361
+
362
+ Parameters
363
+ ----------
364
+ path : str or pathlib.Path
365
+ path to the VSI directory to be removed.
366
+
367
+ """
368
+ if isinstance(path, Path):
369
+ path = path.as_posix()
370
+
371
+ ogr_vsi_rmtree(path)
372
+
373
+
374
+ def vsi_unlink(path: Union[str, Path]):
375
+ """Remove a VSI file.
376
+
377
+ Parameters
378
+ ----------
379
+ path : str or pathlib.Path
380
+ path to vsimem file to be removed
381
+
382
+ """
383
+ if isinstance(path, Path):
384
+ path = path.as_posix()
385
+
386
+ ogr_vsi_unlink(path)
pyogrio/errors.py ADDED
@@ -0,0 +1,25 @@
1
+ """Custom errors."""
2
+
3
+
4
+ class DataSourceError(RuntimeError):
5
+ """Errors relating to opening or closing an OGRDataSource (with >= 1 layers)."""
6
+
7
+
8
+ class DataLayerError(RuntimeError):
9
+ """Errors relating to working with a single OGRLayer."""
10
+
11
+
12
+ class CRSError(DataLayerError):
13
+ """Errors relating to getting or setting CRS values."""
14
+
15
+
16
+ class FeatureError(DataLayerError):
17
+ """Errors related to reading or writing a feature."""
18
+
19
+
20
+ class GeometryError(DataLayerError):
21
+ """Errors relating to getting or setting a geometry field."""
22
+
23
+
24
+ class FieldError(DataLayerError):
25
+ """Errors relating to getting or setting a non-geometry field."""
@@ -0,0 +1,20 @@
1
+ #----------------------------------------------------------------
2
+ # Generated CMake target import file for configuration "Release".
3
+ #----------------------------------------------------------------
4
+
5
+ # Commands may need to know the format version.
6
+ set(CMAKE_IMPORT_FILE_VERSION 1)
7
+
8
+ # Import target "GDAL::GDAL" for configuration "Release"
9
+ set_property(TARGET GDAL::GDAL APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
10
+ set_target_properties(GDAL::GDAL PROPERTIES
11
+ IMPORTED_IMPLIB_RELEASE "${_IMPORT_PREFIX}/lib/gdal.lib"
12
+ IMPORTED_LINK_DEPENDENT_LIBRARIES_RELEASE "json-c::json-c;GEOS::geos_c;PROJ::proj;Qhull::qhull_r;expat::expat;geotiff_library"
13
+ IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/gdal.dll"
14
+ )
15
+
16
+ list(APPEND _cmake_import_check_targets GDAL::GDAL )
17
+ list(APPEND _cmake_import_check_files_for_GDAL::GDAL "${_IMPORT_PREFIX}/lib/gdal.lib" "${_IMPORT_PREFIX}/bin/gdal.dll" )
18
+
19
+ # Commands beyond this point should not need to know the version.
20
+ set(CMAKE_IMPORT_FILE_VERSION)
@@ -0,0 +1,105 @@
1
+ # Generated by CMake
2
+
3
+ if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
4
+ message(FATAL_ERROR "CMake >= 2.8.0 required")
5
+ endif()
6
+ if(CMAKE_VERSION VERSION_LESS "2.8.3")
7
+ message(FATAL_ERROR "CMake >= 2.8.3 required")
8
+ endif()
9
+ cmake_policy(PUSH)
10
+ cmake_policy(VERSION 2.8.3...3.28)
11
+ #----------------------------------------------------------------
12
+ # Generated CMake target import file.
13
+ #----------------------------------------------------------------
14
+
15
+ # Commands may need to know the format version.
16
+ set(CMAKE_IMPORT_FILE_VERSION 1)
17
+
18
+ # Protect against multiple inclusion, which would fail when already imported targets are added once more.
19
+ set(_cmake_targets_defined "")
20
+ set(_cmake_targets_not_defined "")
21
+ set(_cmake_expected_targets "")
22
+ foreach(_cmake_expected_target IN ITEMS GDAL::GDAL)
23
+ list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
24
+ if(TARGET "${_cmake_expected_target}")
25
+ list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
26
+ else()
27
+ list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
28
+ endif()
29
+ endforeach()
30
+ unset(_cmake_expected_target)
31
+ if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
32
+ unset(_cmake_targets_defined)
33
+ unset(_cmake_targets_not_defined)
34
+ unset(_cmake_expected_targets)
35
+ unset(CMAKE_IMPORT_FILE_VERSION)
36
+ cmake_policy(POP)
37
+ return()
38
+ endif()
39
+ if(NOT _cmake_targets_defined STREQUAL "")
40
+ string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
41
+ string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
42
+ message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
43
+ endif()
44
+ unset(_cmake_targets_defined)
45
+ unset(_cmake_targets_not_defined)
46
+ unset(_cmake_expected_targets)
47
+
48
+
49
+ # Compute the installation prefix relative to this file.
50
+ get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
51
+ get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
52
+ get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
53
+ if(_IMPORT_PREFIX STREQUAL "/")
54
+ set(_IMPORT_PREFIX "")
55
+ endif()
56
+
57
+ # Create imported target GDAL::GDAL
58
+ add_library(GDAL::GDAL SHARED IMPORTED)
59
+
60
+ set_target_properties(GDAL::GDAL PROPERTIES
61
+ INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
62
+ )
63
+
64
+ # Load information for each installed configuration.
65
+ file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/GDAL-targets-*.cmake")
66
+ foreach(_cmake_config_file IN LISTS _cmake_config_files)
67
+ include("${_cmake_config_file}")
68
+ endforeach()
69
+ unset(_cmake_config_file)
70
+ unset(_cmake_config_files)
71
+
72
+ # Cleanup temporary variables.
73
+ set(_IMPORT_PREFIX)
74
+
75
+ # Loop over all imported files and verify that they actually exist
76
+ foreach(_cmake_target IN LISTS _cmake_import_check_targets)
77
+ if(CMAKE_VERSION VERSION_LESS "3.28"
78
+ OR NOT DEFINED _cmake_import_check_xcframework_for_${_cmake_target}
79
+ OR NOT IS_DIRECTORY "${_cmake_import_check_xcframework_for_${_cmake_target}}")
80
+ foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
81
+ if(NOT EXISTS "${_cmake_file}")
82
+ message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
83
+ \"${_cmake_file}\"
84
+ but this file does not exist. Possible reasons include:
85
+ * The file was deleted, renamed, or moved to another location.
86
+ * An install or uninstall procedure did not complete successfully.
87
+ * The installation package was faulty and contained
88
+ \"${CMAKE_CURRENT_LIST_FILE}\"
89
+ but not all the files it references.
90
+ ")
91
+ endif()
92
+ endforeach()
93
+ endif()
94
+ unset(_cmake_file)
95
+ unset("_cmake_import_check_files_for_${_cmake_target}")
96
+ endforeach()
97
+ unset(_cmake_target)
98
+ unset(_cmake_import_check_targets)
99
+
100
+ # This file does not depend on other imported targets which have
101
+ # been exported from the same project but in a separate export set.
102
+
103
+ # Commands beyond this point should not need to know the version.
104
+ set(CMAKE_IMPORT_FILE_VERSION)
105
+ cmake_policy(POP)
@@ -0,0 +1,23 @@
1
+ cmake_policy(SET CMP0012 NEW)
2
+ cmake_policy(SET CMP0057 NEW)
3
+ if(NOT "ON")
4
+ if(NOT CMAKE_CXX_COMPILER_LOADED)
5
+ message(WARNING "Linking to GDAL may need CXX to be enabled.")
6
+ endif()
7
+ if(DEFINED CMAKE_MODULE_PATH)
8
+ set(_gdal_module_path_backup "${CMAKE_MODULE_PATH}")
9
+ endif()
10
+ include(CMakeFindDependencyMacro)
11
+ # gdal needs a pkg-config tool. A host dependency provides pkgconf.
12
+ get_filename_component(vcpkg_host_prefix "${CMAKE_CURRENT_LIST_DIR}/../../../x64-windows" ABSOLUTE)
13
+ list(APPEND CMAKE_PROGRAM_PATH "${vcpkg_host_prefix}/tools/pkgconf")
14
+ include("${CMAKE_CURRENT_LIST_DIR}/DefineFindPackage2.cmake")
15
+ include("${CMAKE_CURRENT_LIST_DIR}/GdalFindModulePath.cmake")
16
+
17
+ if(DEFINED _gdal_module_path_backup)
18
+ set(CMAKE_MODULE_PATH "${_gdal_module_path_backup}")
19
+ else()
20
+ unset(CMAKE_MODULE_PATH)
21
+ endif()
22
+ endif()
23
+ include("${CMAKE_CURRENT_LIST_DIR}/GDAL-targets.cmake")
@@ -0,0 +1,85 @@
1
+ # This is a basic version file for the Config-mode of find_package().
2
+ # It is used by write_basic_package_version_file() as input file for configure_file()
3
+ # to create a version-file which can be installed along a config.cmake file.
4
+ #
5
+ # The created file sets PACKAGE_VERSION_EXACT if the current version string and
6
+ # the requested version string are exactly the same and it sets
7
+ # PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
8
+ # but only if the requested major and minor versions are the same as the current
9
+ # one.
10
+ # The variable CVF_VERSION must be set before calling configure_file().
11
+
12
+
13
+ set(PACKAGE_VERSION "3.9.1")
14
+
15
+ if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
16
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
17
+ else()
18
+
19
+ if("3.9.1" MATCHES "^([0-9]+)\\.([0-9]+)")
20
+ set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
21
+ set(CVF_VERSION_MINOR "${CMAKE_MATCH_2}")
22
+
23
+ if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
24
+ string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
25
+ endif()
26
+ if(NOT CVF_VERSION_MINOR VERSION_EQUAL 0)
27
+ string(REGEX REPLACE "^0+" "" CVF_VERSION_MINOR "${CVF_VERSION_MINOR}")
28
+ endif()
29
+ else()
30
+ set(CVF_VERSION_MAJOR "3.9.1")
31
+ set(CVF_VERSION_MINOR "")
32
+ endif()
33
+
34
+ if(PACKAGE_FIND_VERSION_RANGE)
35
+ # both endpoints of the range must have the expected major and minor versions
36
+ math (EXPR CVF_VERSION_MINOR_NEXT "${CVF_VERSION_MINOR} + 1")
37
+ if (NOT (PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
38
+ AND PACKAGE_FIND_VERSION_MIN_MINOR STREQUAL CVF_VERSION_MINOR)
39
+ OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE"
40
+ AND NOT (PACKAGE_FIND_VERSION_MAX_MAJOR STREQUAL CVF_VERSION_MAJOR
41
+ AND PACKAGE_FIND_VERSION_MAX_MINOR STREQUAL CVF_VERSION_MINOR))
42
+ OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE"
43
+ AND NOT PACKAGE_FIND_VERSION_MAX VERSION_LESS_EQUAL ${CVF_VERSION_MAJOR}.${CVF_VERSION_MINOR_NEXT})))
44
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
45
+ elseif(PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
46
+ AND PACKAGE_FIND_VERSION_MIN_MINOR STREQUAL CVF_VERSION_MINOR
47
+ AND ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS_EQUAL PACKAGE_FIND_VERSION_MAX)
48
+ OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MAX)))
49
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
50
+ else()
51
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
52
+ endif()
53
+ else()
54
+ if(NOT PACKAGE_FIND_VERSION_MAJOR VERSION_EQUAL 0)
55
+ string(REGEX REPLACE "^0+" "" PACKAGE_FIND_VERSION_MAJOR "${PACKAGE_FIND_VERSION_MAJOR}")
56
+ endif()
57
+ if(NOT PACKAGE_FIND_VERSION_MINOR VERSION_EQUAL 0)
58
+ string(REGEX REPLACE "^0+" "" PACKAGE_FIND_VERSION_MINOR "${PACKAGE_FIND_VERSION_MINOR}")
59
+ endif()
60
+
61
+ if((PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR) AND
62
+ (PACKAGE_FIND_VERSION_MINOR STREQUAL CVF_VERSION_MINOR))
63
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
64
+ else()
65
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
66
+ endif()
67
+
68
+ if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
69
+ set(PACKAGE_VERSION_EXACT TRUE)
70
+ endif()
71
+ endif()
72
+ endif()
73
+
74
+
75
+ # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
76
+ if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
77
+ return()
78
+ endif()
79
+
80
+ # check that the installed version has the same 32/64bit-ness as the one which is currently searching:
81
+ if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
82
+ math(EXPR installedBits "8 * 8")
83
+ set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
84
+ set(PACKAGE_VERSION_UNSUITABLE TRUE)
85
+ endif()