pyogrio 0.8.0__cp312-cp312-manylinux_2_28_aarch64.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 (238) hide show
  1. pyogrio/__init__.py +48 -0
  2. pyogrio/_compat.py +41 -0
  3. pyogrio/_env.py +61 -0
  4. pyogrio/_err.cpython-312-aarch64-linux-gnu.so +0 -0
  5. pyogrio/_err.pxd +4 -0
  6. pyogrio/_err.pyx +250 -0
  7. pyogrio/_geometry.cpython-312-aarch64-linux-gnu.so +0 -0
  8. pyogrio/_geometry.pxd +4 -0
  9. pyogrio/_geometry.pyx +129 -0
  10. pyogrio/_io.cpython-312-aarch64-linux-gnu.so +0 -0
  11. pyogrio/_io.pxd +0 -0
  12. pyogrio/_io.pyx +2738 -0
  13. pyogrio/_ogr.cpython-312-aarch64-linux-gnu.so +0 -0
  14. pyogrio/_ogr.pxd +441 -0
  15. pyogrio/_ogr.pyx +346 -0
  16. pyogrio/_version.py +21 -0
  17. pyogrio/_vsi.cpython-312-aarch64-linux-gnu.so +0 -0
  18. pyogrio/_vsi.pxd +4 -0
  19. pyogrio/_vsi.pyx +140 -0
  20. pyogrio/arrow_bridge.h +115 -0
  21. pyogrio/core.py +320 -0
  22. pyogrio/errors.py +32 -0
  23. pyogrio/gdal_data/GDAL-targets-release.cmake +19 -0
  24. pyogrio/gdal_data/GDAL-targets.cmake +105 -0
  25. pyogrio/gdal_data/GDALConfig.cmake +25 -0
  26. pyogrio/gdal_data/GDALConfigVersion.cmake +85 -0
  27. pyogrio/gdal_data/GDALLogoBW.svg +138 -0
  28. pyogrio/gdal_data/GDALLogoColor.svg +126 -0
  29. pyogrio/gdal_data/GDALLogoGS.svg +126 -0
  30. pyogrio/gdal_data/LICENSE.TXT +467 -0
  31. pyogrio/gdal_data/bag_template.xml +201 -0
  32. pyogrio/gdal_data/copyright +467 -0
  33. pyogrio/gdal_data/cubewerx_extra.wkt +48 -0
  34. pyogrio/gdal_data/default.rsc +0 -0
  35. pyogrio/gdal_data/ecw_cs.wkt +1453 -0
  36. pyogrio/gdal_data/eedaconf.json +23 -0
  37. pyogrio/gdal_data/epsg.wkt +1 -0
  38. pyogrio/gdal_data/esri_StatePlane_extra.wkt +631 -0
  39. pyogrio/gdal_data/gdalicon.png +0 -0
  40. pyogrio/gdal_data/gdalinfo_output.schema.json +346 -0
  41. pyogrio/gdal_data/gdalmdiminfo_output.schema.json +321 -0
  42. pyogrio/gdal_data/gdalvrt.xsd +772 -0
  43. pyogrio/gdal_data/gfs.xsd +246 -0
  44. pyogrio/gdal_data/gml_registry.xml +117 -0
  45. pyogrio/gdal_data/gml_registry.xsd +66 -0
  46. pyogrio/gdal_data/gmlasconf.xml +169 -0
  47. pyogrio/gdal_data/gmlasconf.xsd +1066 -0
  48. pyogrio/gdal_data/grib2_center.csv +251 -0
  49. pyogrio/gdal_data/grib2_process.csv +102 -0
  50. pyogrio/gdal_data/grib2_subcenter.csv +63 -0
  51. pyogrio/gdal_data/grib2_table_4_2_0_0.csv +261 -0
  52. pyogrio/gdal_data/grib2_table_4_2_0_1.csv +261 -0
  53. pyogrio/gdal_data/grib2_table_4_2_0_13.csv +261 -0
  54. pyogrio/gdal_data/grib2_table_4_2_0_14.csv +261 -0
  55. pyogrio/gdal_data/grib2_table_4_2_0_15.csv +261 -0
  56. pyogrio/gdal_data/grib2_table_4_2_0_16.csv +261 -0
  57. pyogrio/gdal_data/grib2_table_4_2_0_17.csv +11 -0
  58. pyogrio/gdal_data/grib2_table_4_2_0_18.csv +261 -0
  59. pyogrio/gdal_data/grib2_table_4_2_0_19.csv +261 -0
  60. pyogrio/gdal_data/grib2_table_4_2_0_190.csv +261 -0
  61. pyogrio/gdal_data/grib2_table_4_2_0_191.csv +261 -0
  62. pyogrio/gdal_data/grib2_table_4_2_0_2.csv +261 -0
  63. pyogrio/gdal_data/grib2_table_4_2_0_20.csv +261 -0
  64. pyogrio/gdal_data/grib2_table_4_2_0_21.csv +261 -0
  65. pyogrio/gdal_data/grib2_table_4_2_0_3.csv +261 -0
  66. pyogrio/gdal_data/grib2_table_4_2_0_4.csv +261 -0
  67. pyogrio/gdal_data/grib2_table_4_2_0_5.csv +261 -0
  68. pyogrio/gdal_data/grib2_table_4_2_0_6.csv +261 -0
  69. pyogrio/gdal_data/grib2_table_4_2_0_7.csv +261 -0
  70. pyogrio/gdal_data/grib2_table_4_2_10_0.csv +261 -0
  71. pyogrio/gdal_data/grib2_table_4_2_10_1.csv +261 -0
  72. pyogrio/gdal_data/grib2_table_4_2_10_191.csv +261 -0
  73. pyogrio/gdal_data/grib2_table_4_2_10_2.csv +261 -0
  74. pyogrio/gdal_data/grib2_table_4_2_10_3.csv +261 -0
  75. pyogrio/gdal_data/grib2_table_4_2_10_4.csv +261 -0
  76. pyogrio/gdal_data/grib2_table_4_2_1_0.csv +261 -0
  77. pyogrio/gdal_data/grib2_table_4_2_1_1.csv +261 -0
  78. pyogrio/gdal_data/grib2_table_4_2_1_2.csv +261 -0
  79. pyogrio/gdal_data/grib2_table_4_2_20_0.csv +261 -0
  80. pyogrio/gdal_data/grib2_table_4_2_20_1.csv +261 -0
  81. pyogrio/gdal_data/grib2_table_4_2_20_2.csv +261 -0
  82. pyogrio/gdal_data/grib2_table_4_2_2_0.csv +261 -0
  83. pyogrio/gdal_data/grib2_table_4_2_2_3.csv +261 -0
  84. pyogrio/gdal_data/grib2_table_4_2_2_4.csv +261 -0
  85. pyogrio/gdal_data/grib2_table_4_2_2_5.csv +261 -0
  86. pyogrio/gdal_data/grib2_table_4_2_2_6.csv +261 -0
  87. pyogrio/gdal_data/grib2_table_4_2_3_0.csv +261 -0
  88. pyogrio/gdal_data/grib2_table_4_2_3_1.csv +261 -0
  89. pyogrio/gdal_data/grib2_table_4_2_3_2.csv +28 -0
  90. pyogrio/gdal_data/grib2_table_4_2_3_3.csv +8 -0
  91. pyogrio/gdal_data/grib2_table_4_2_3_4.csv +14 -0
  92. pyogrio/gdal_data/grib2_table_4_2_3_5.csv +11 -0
  93. pyogrio/gdal_data/grib2_table_4_2_3_6.csv +11 -0
  94. pyogrio/gdal_data/grib2_table_4_2_4_0.csv +261 -0
  95. pyogrio/gdal_data/grib2_table_4_2_4_1.csv +261 -0
  96. pyogrio/gdal_data/grib2_table_4_2_4_10.csv +261 -0
  97. pyogrio/gdal_data/grib2_table_4_2_4_2.csv +261 -0
  98. pyogrio/gdal_data/grib2_table_4_2_4_3.csv +261 -0
  99. pyogrio/gdal_data/grib2_table_4_2_4_4.csv +261 -0
  100. pyogrio/gdal_data/grib2_table_4_2_4_5.csv +261 -0
  101. pyogrio/gdal_data/grib2_table_4_2_4_6.csv +261 -0
  102. pyogrio/gdal_data/grib2_table_4_2_4_7.csv +261 -0
  103. pyogrio/gdal_data/grib2_table_4_2_4_8.csv +261 -0
  104. pyogrio/gdal_data/grib2_table_4_2_4_9.csv +261 -0
  105. pyogrio/gdal_data/grib2_table_4_2_local_Canada.csv +5 -0
  106. pyogrio/gdal_data/grib2_table_4_2_local_HPC.csv +2 -0
  107. pyogrio/gdal_data/grib2_table_4_2_local_MRMS.csv +175 -0
  108. pyogrio/gdal_data/grib2_table_4_2_local_NCEP.csv +401 -0
  109. pyogrio/gdal_data/grib2_table_4_2_local_NDFD.csv +38 -0
  110. pyogrio/gdal_data/grib2_table_4_2_local_index.csv +7 -0
  111. pyogrio/gdal_data/grib2_table_4_5.csv +261 -0
  112. pyogrio/gdal_data/grib2_table_versions.csv +3 -0
  113. pyogrio/gdal_data/gt_datum.csv +229 -0
  114. pyogrio/gdal_data/gt_ellips.csv +24 -0
  115. pyogrio/gdal_data/header.dxf +1124 -0
  116. pyogrio/gdal_data/inspire_cp_BasicPropertyUnit.gfs +57 -0
  117. pyogrio/gdal_data/inspire_cp_CadastralBoundary.gfs +60 -0
  118. pyogrio/gdal_data/inspire_cp_CadastralParcel.gfs +81 -0
  119. pyogrio/gdal_data/inspire_cp_CadastralZoning.gfs +161 -0
  120. pyogrio/gdal_data/jpfgdgml_AdmArea.gfs +59 -0
  121. pyogrio/gdal_data/jpfgdgml_AdmBdry.gfs +49 -0
  122. pyogrio/gdal_data/jpfgdgml_AdmPt.gfs +59 -0
  123. pyogrio/gdal_data/jpfgdgml_BldA.gfs +54 -0
  124. pyogrio/gdal_data/jpfgdgml_BldL.gfs +54 -0
  125. pyogrio/gdal_data/jpfgdgml_Cntr.gfs +54 -0
  126. pyogrio/gdal_data/jpfgdgml_CommBdry.gfs +49 -0
  127. pyogrio/gdal_data/jpfgdgml_CommPt.gfs +59 -0
  128. pyogrio/gdal_data/jpfgdgml_Cstline.gfs +54 -0
  129. pyogrio/gdal_data/jpfgdgml_ElevPt.gfs +54 -0
  130. pyogrio/gdal_data/jpfgdgml_GCP.gfs +94 -0
  131. pyogrio/gdal_data/jpfgdgml_LeveeEdge.gfs +49 -0
  132. pyogrio/gdal_data/jpfgdgml_RailCL.gfs +54 -0
  133. pyogrio/gdal_data/jpfgdgml_RdASL.gfs +44 -0
  134. pyogrio/gdal_data/jpfgdgml_RdArea.gfs +54 -0
  135. pyogrio/gdal_data/jpfgdgml_RdCompt.gfs +59 -0
  136. pyogrio/gdal_data/jpfgdgml_RdEdg.gfs +59 -0
  137. pyogrio/gdal_data/jpfgdgml_RdMgtBdry.gfs +49 -0
  138. pyogrio/gdal_data/jpfgdgml_RdSgmtA.gfs +59 -0
  139. pyogrio/gdal_data/jpfgdgml_RvrMgtBdry.gfs +49 -0
  140. pyogrio/gdal_data/jpfgdgml_SBAPt.gfs +49 -0
  141. pyogrio/gdal_data/jpfgdgml_SBArea.gfs +54 -0
  142. pyogrio/gdal_data/jpfgdgml_SBBdry.gfs +44 -0
  143. pyogrio/gdal_data/jpfgdgml_WA.gfs +54 -0
  144. pyogrio/gdal_data/jpfgdgml_WL.gfs +54 -0
  145. pyogrio/gdal_data/jpfgdgml_WStrA.gfs +54 -0
  146. pyogrio/gdal_data/jpfgdgml_WStrL.gfs +54 -0
  147. pyogrio/gdal_data/netcdf_config.xsd +143 -0
  148. pyogrio/gdal_data/nitf_spec.xml +3306 -0
  149. pyogrio/gdal_data/nitf_spec.xsd +189 -0
  150. pyogrio/gdal_data/ogrinfo_output.schema.json +505 -0
  151. pyogrio/gdal_data/ogrvrt.xsd +543 -0
  152. pyogrio/gdal_data/osmconf.ini +132 -0
  153. pyogrio/gdal_data/ozi_datum.csv +131 -0
  154. pyogrio/gdal_data/ozi_ellips.csv +35 -0
  155. pyogrio/gdal_data/pci_datum.txt +463 -0
  156. pyogrio/gdal_data/pci_ellips.txt +77 -0
  157. pyogrio/gdal_data/pdfcomposition.xsd +721 -0
  158. pyogrio/gdal_data/pds4_template.xml +65 -0
  159. pyogrio/gdal_data/plscenesconf.json +1985 -0
  160. pyogrio/gdal_data/ruian_vf_ob_v1.gfs +1455 -0
  161. pyogrio/gdal_data/ruian_vf_st_uvoh_v1.gfs +86 -0
  162. pyogrio/gdal_data/ruian_vf_st_v1.gfs +1489 -0
  163. pyogrio/gdal_data/ruian_vf_v1.gfs +2126 -0
  164. pyogrio/gdal_data/s57agencies.csv +249 -0
  165. pyogrio/gdal_data/s57attributes.csv +484 -0
  166. pyogrio/gdal_data/s57expectedinput.csv +1008 -0
  167. pyogrio/gdal_data/s57objectclasses.csv +287 -0
  168. pyogrio/gdal_data/seed_2d.dgn +0 -0
  169. pyogrio/gdal_data/seed_3d.dgn +0 -0
  170. pyogrio/gdal_data/stateplane.csv +259 -0
  171. pyogrio/gdal_data/template_tiles.mapml +28 -0
  172. pyogrio/gdal_data/tms_LINZAntarticaMapTileGrid.json +190 -0
  173. pyogrio/gdal_data/tms_MapML_APSTILE.json +268 -0
  174. pyogrio/gdal_data/tms_MapML_CBMTILE.json +346 -0
  175. pyogrio/gdal_data/tms_NZTM2000.json +243 -0
  176. pyogrio/gdal_data/trailer.dxf +434 -0
  177. pyogrio/gdal_data/usage +4 -0
  178. pyogrio/gdal_data/vcpkg-cmake-wrapper.cmake +23 -0
  179. pyogrio/gdal_data/vcpkg.spdx.json +264 -0
  180. pyogrio/gdal_data/vcpkg_abi_info.txt +41 -0
  181. pyogrio/gdal_data/vdv452.xml +367 -0
  182. pyogrio/gdal_data/vdv452.xsd +63 -0
  183. pyogrio/gdal_data/vicar.json +164 -0
  184. pyogrio/geopandas.py +666 -0
  185. pyogrio/proj_data/CH +22 -0
  186. pyogrio/proj_data/GL27 +23 -0
  187. pyogrio/proj_data/ITRF2000 +24 -0
  188. pyogrio/proj_data/ITRF2008 +94 -0
  189. pyogrio/proj_data/ITRF2014 +55 -0
  190. pyogrio/proj_data/copyright +34 -0
  191. pyogrio/proj_data/deformation_model.schema.json +582 -0
  192. pyogrio/proj_data/nad.lst +142 -0
  193. pyogrio/proj_data/nad27 +810 -0
  194. pyogrio/proj_data/nad83 +745 -0
  195. pyogrio/proj_data/other.extra +53 -0
  196. pyogrio/proj_data/proj-config-version.cmake +44 -0
  197. pyogrio/proj_data/proj-config.cmake +79 -0
  198. pyogrio/proj_data/proj-targets-release.cmake +19 -0
  199. pyogrio/proj_data/proj-targets.cmake +107 -0
  200. pyogrio/proj_data/proj.db +0 -0
  201. pyogrio/proj_data/proj.ini +51 -0
  202. pyogrio/proj_data/proj4-targets-release.cmake +19 -0
  203. pyogrio/proj_data/proj4-targets.cmake +107 -0
  204. pyogrio/proj_data/projjson.schema.json +1174 -0
  205. pyogrio/proj_data/triangulation.schema.json +214 -0
  206. pyogrio/proj_data/usage +4 -0
  207. pyogrio/proj_data/vcpkg.spdx.json +198 -0
  208. pyogrio/proj_data/vcpkg_abi_info.txt +27 -0
  209. pyogrio/proj_data/world +214 -0
  210. pyogrio/raw.py +871 -0
  211. pyogrio/tests/__init__.py +0 -0
  212. pyogrio/tests/conftest.py +204 -0
  213. pyogrio/tests/fixtures/README.md +89 -0
  214. pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.cpg +1 -0
  215. pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.dbf +0 -0
  216. pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.prj +1 -0
  217. pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.shp +0 -0
  218. pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.shx +0 -0
  219. pyogrio/tests/fixtures/sample.osm.pbf +0 -0
  220. pyogrio/tests/fixtures/test_datetime.geojson +7 -0
  221. pyogrio/tests/fixtures/test_datetime_tz.geojson +8 -0
  222. pyogrio/tests/fixtures/test_fgdb.gdb.zip +0 -0
  223. pyogrio/tests/fixtures/test_gpkg_nulls.gpkg +0 -0
  224. pyogrio/tests/fixtures/test_multisurface.gpkg +0 -0
  225. pyogrio/tests/fixtures/test_nested.geojson +18 -0
  226. pyogrio/tests/fixtures/test_ogr_types_list.geojson +12 -0
  227. pyogrio/tests/test_arrow.py +1041 -0
  228. pyogrio/tests/test_core.py +588 -0
  229. pyogrio/tests/test_geopandas_io.py +2069 -0
  230. pyogrio/tests/test_path.py +351 -0
  231. pyogrio/tests/test_raw_io.py +1404 -0
  232. pyogrio/util.py +223 -0
  233. pyogrio-0.8.0.dist-info/LICENSE +21 -0
  234. pyogrio-0.8.0.dist-info/METADATA +100 -0
  235. pyogrio-0.8.0.dist-info/RECORD +238 -0
  236. pyogrio-0.8.0.dist-info/WHEEL +5 -0
  237. pyogrio-0.8.0.dist-info/top_level.txt +1 -0
  238. pyogrio.libs/libgdal-b2fb2022.so.34.3.8.5 +0 -0
pyogrio/core.py ADDED
@@ -0,0 +1,320 @@
1
+ from pyogrio._env import GDALEnv
2
+ from pyogrio.util import (
3
+ get_vsi_path_or_buffer,
4
+ _preprocess_options_key_value,
5
+ _mask_to_wkb,
6
+ )
7
+
8
+
9
+ with GDALEnv():
10
+ from pyogrio._ogr import (
11
+ get_gdal_version,
12
+ get_gdal_version_string,
13
+ get_gdal_geos_version,
14
+ ogr_list_drivers,
15
+ set_gdal_config_options as _set_gdal_config_options,
16
+ get_gdal_config_option as _get_gdal_config_option,
17
+ get_gdal_data_path as _get_gdal_data_path,
18
+ init_gdal_data as _init_gdal_data,
19
+ init_proj_data as _init_proj_data,
20
+ _register_drivers,
21
+ _get_drivers_for_path,
22
+ )
23
+ from pyogrio._err import _register_error_handler
24
+ from pyogrio._io import ogr_list_layers, ogr_read_bounds, ogr_read_info
25
+
26
+ _init_gdal_data()
27
+ _init_proj_data()
28
+ _register_drivers()
29
+ _register_error_handler()
30
+
31
+ __gdal_version__ = get_gdal_version()
32
+ __gdal_version_string__ = get_gdal_version_string()
33
+ __gdal_geos_version__ = get_gdal_geos_version()
34
+
35
+
36
+ def list_drivers(read=False, write=False):
37
+ """List drivers available in GDAL.
38
+
39
+ Parameters
40
+ ----------
41
+ read: bool, optional (default: False)
42
+ If True, will only return drivers that are known to support read capabilities.
43
+ write: bool, optional (default: False)
44
+ If True, will only return drivers that are known to support write capabilities.
45
+
46
+ Returns
47
+ -------
48
+ dict
49
+ Mapping of driver name to file mode capabilities: ``"r"``: read, ``"w"``: write.
50
+ Drivers that are available but with unknown support are marked with ``"?"``
51
+ """
52
+
53
+ drivers = ogr_list_drivers()
54
+
55
+ if read:
56
+ drivers = {k: v for k, v in drivers.items() if v.startswith("r")}
57
+
58
+ if write:
59
+ drivers = {k: v for k, v in drivers.items() if v.endswith("w")}
60
+
61
+ return drivers
62
+
63
+
64
+ def detect_write_driver(path):
65
+ """Attempt to infer the driver for a path by extension or prefix. Only
66
+ drivers that support write capabilities will be detected.
67
+
68
+ If the path cannot be resolved to a single driver, a ValueError will be
69
+ raised.
70
+
71
+ Parameters
72
+ ----------
73
+ path : str
74
+
75
+ Returns
76
+ -------
77
+ str
78
+ name of the driver, if detected
79
+ """
80
+ # try to infer driver from path
81
+ drivers = _get_drivers_for_path(path)
82
+
83
+ if len(drivers) == 0:
84
+ raise ValueError(
85
+ f"Could not infer driver from path: {path}; please specify driver "
86
+ "explicitly"
87
+ )
88
+
89
+ # if there are multiple drivers detected, user needs to specify the correct
90
+ # one manually
91
+ elif len(drivers) > 1:
92
+ raise ValueError(
93
+ f"Could not infer driver from path: {path}; multiple drivers are "
94
+ f"available for that extension: {', '.join(drivers)}. Please "
95
+ "specify driver explicitly."
96
+ )
97
+
98
+ return drivers[0]
99
+
100
+
101
+ def list_layers(path_or_buffer, /):
102
+ """List layers available in an OGR data source.
103
+
104
+ NOTE: includes both spatial and nonspatial layers.
105
+
106
+ Parameters
107
+ ----------
108
+ path_or_buffer : str, pathlib.Path, bytes, or file-like
109
+
110
+ Returns
111
+ -------
112
+ ndarray shape (2, n)
113
+ array of pairs of [<layer name>, <layer geometry type>]
114
+ Note: geometry is `None` for nonspatial layers.
115
+ """
116
+
117
+ return ogr_list_layers(get_vsi_path_or_buffer(path_or_buffer))
118
+
119
+
120
+ def read_bounds(
121
+ path_or_buffer,
122
+ /,
123
+ layer=None,
124
+ skip_features=0,
125
+ max_features=None,
126
+ where=None,
127
+ bbox=None,
128
+ mask=None,
129
+ ):
130
+ """Read bounds of each feature.
131
+
132
+ This can be used to assist with spatial indexing and partitioning, in
133
+ order to avoid reading all features into memory. It is roughly 2-3x faster
134
+ than reading the full geometry and attributes of a dataset.
135
+
136
+ Parameters
137
+ ----------
138
+ path_or_buffer : str, pathlib.Path, bytes, or file-like
139
+ layer : int or str, optional (default: first layer)
140
+ If an integer is provided, it corresponds to the index of the layer
141
+ with the data source. If a string is provided, it must match the name
142
+ of the layer in the data source. Defaults to first layer in data source.
143
+ skip_features : int, optional (default: 0)
144
+ Number of features to skip from the beginning of the file before returning
145
+ features. Must be less than the total number of features in the file.
146
+ max_features : int, optional (default: None)
147
+ Number of features to read from the file. Must be less than the total
148
+ number of features in the file minus ``skip_features`` (if used).
149
+ where : str, optional (default: None)
150
+ Where clause to filter features in layer by attribute values. Uses a
151
+ restricted form of SQL WHERE clause, defined here:
152
+ http://ogdi.sourceforge.net/prop/6.2.CapabilitiesMetadata.html
153
+ Examples: ``"ISO_A3 = 'CAN'"``, ``"POP_EST > 10000000 AND POP_EST < 100000000"``
154
+ bbox : tuple of (xmin, ymin, xmax, ymax), optional (default: None)
155
+ If present, will be used to filter records whose geometry intersects this
156
+ box. This must be in the same CRS as the dataset. If GEOS is present
157
+ and used by GDAL, only geometries that intersect this bbox will be
158
+ returned; if GEOS is not available or not used by GDAL, all geometries
159
+ with bounding boxes that intersect this bbox will be returned.
160
+ mask : Shapely geometry, optional (default: None)
161
+ If present, will be used to filter records whose geometry intersects
162
+ this geometry. This must be in the same CRS as the dataset. If GEOS is
163
+ present and used by GDAL, only geometries that intersect this geometry
164
+ will be returned; if GEOS is not available or not used by GDAL, all
165
+ geometries with bounding boxes that intersect the bounding box of this
166
+ geometry will be returned. Requires Shapely >= 2.0.
167
+ Cannot be combined with ``bbox`` keyword.
168
+
169
+ Returns
170
+ -------
171
+ tuple of (fids, bounds)
172
+ fids are global IDs read from the FID field of the dataset
173
+ bounds are ndarray of shape(4, n) containing ``xmin``, ``ymin``, ``xmax``,
174
+ ``ymax``
175
+ """
176
+
177
+ return ogr_read_bounds(
178
+ get_vsi_path_or_buffer(path_or_buffer),
179
+ layer=layer,
180
+ skip_features=skip_features,
181
+ max_features=max_features or 0,
182
+ where=where,
183
+ bbox=bbox,
184
+ mask=_mask_to_wkb(mask),
185
+ )
186
+
187
+
188
+ def read_info(
189
+ path_or_buffer,
190
+ /,
191
+ layer=None,
192
+ encoding=None,
193
+ force_feature_count=False,
194
+ force_total_bounds=False,
195
+ **kwargs,
196
+ ):
197
+ """Read information about an OGR data source.
198
+
199
+ ``crs``, ``geometry`` and ``total_bounds`` will be ``None`` and ``features`` will be
200
+ 0 for a nonspatial layer.
201
+
202
+ ``features`` will be -1 if this is an expensive operation for this driver. You can
203
+ force it to be calculated using the ``force_feature_count`` parameter.
204
+
205
+ ``total_bounds`` is the 2-dimensional extent of all features within the dataset:
206
+ (xmin, ymin, xmax, ymax). It will be None if this is an expensive operation for this
207
+ driver or if the data source is nonspatial. You can force it to be calculated using
208
+ the ``force_total_bounds`` parameter.
209
+
210
+ ``fid_column`` is the name of the FID field in the data source, if the FID is
211
+ physically stored (e.g. in GPKG). If the FID is just a sequence, ``fid_column``
212
+ will be "" (e.g. ESRI Shapefile).
213
+
214
+ ``geometry_name`` is the name of the field where the main geometry is stored in the
215
+ data data source, if the field name can by customized (e.g. in GPKG). If no custom
216
+ name is supported, ``geometry_name`` will be "" (e.g. ESRI Shapefile).
217
+
218
+ ``encoding`` will be ``UTF-8`` if either the native encoding is likely to be
219
+ ``UTF-8`` or GDAL can automatically convert from the detected native encoding
220
+ to ``UTF-8``.
221
+
222
+ Parameters
223
+ ----------
224
+ path_or_buffer : str, pathlib.Path, bytes, or file-like
225
+ layer : [type], optional
226
+ Name or index of layer in data source. Reads the first layer by default.
227
+ encoding : [type], optional (default: None)
228
+ If present, will be used as the encoding for reading string values from
229
+ the data source, unless encoding can be inferred directly from the data
230
+ source.
231
+ force_feature_count : bool, optional (default: False)
232
+ True if the feature count should be computed even if it is expensive.
233
+ force_total_bounds : bool, optional (default: False)
234
+ True if the total bounds should be computed even if it is expensive.
235
+ **kwargs
236
+ Additional driver-specific dataset open options passed to OGR. Invalid
237
+ options will trigger a warning.
238
+
239
+ Returns
240
+ -------
241
+ dict
242
+ A dictionary with the following keys::
243
+
244
+ {
245
+ "layer_name": "<layer name>",
246
+ "crs": "<crs>",
247
+ "fields": <ndarray of field names>,
248
+ "dtypes": <ndarray of field dtypes>,
249
+ "encoding": "<encoding>",
250
+ "fid_column": "<fid column name or "">",
251
+ "geometry_name": "<geometry column name or "">",
252
+ "geometry_type": "<geometry type>",
253
+ "features": <feature count or -1>,
254
+ "total_bounds": <tuple with total bounds or None>,
255
+ "driver": "<driver>",
256
+ "capabilities": "<dict of driver capabilities>"
257
+ "dataset_metadata": "<dict of dataset metadata or None>"
258
+ "layer_metadata": "<dict of layer metadata or None>"
259
+ }
260
+ """
261
+
262
+ dataset_kwargs = _preprocess_options_key_value(kwargs) if kwargs else {}
263
+
264
+ return ogr_read_info(
265
+ get_vsi_path_or_buffer(path_or_buffer),
266
+ layer=layer,
267
+ encoding=encoding,
268
+ force_feature_count=force_feature_count,
269
+ force_total_bounds=force_total_bounds,
270
+ dataset_kwargs=dataset_kwargs,
271
+ )
272
+
273
+
274
+ def set_gdal_config_options(options):
275
+ """Set GDAL configuration options.
276
+
277
+ Options are listed here: https://trac.osgeo.org/gdal/wiki/ConfigOptions
278
+
279
+ No error is raised if invalid option names are provided.
280
+
281
+ These options are applied for an entire session rather than for individual
282
+ functions.
283
+
284
+ Parameters
285
+ ----------
286
+ options : dict
287
+ If present, provides a mapping of option name / value pairs for GDAL
288
+ configuration options. ``True`` / ``False`` are normalized to ``'ON'``
289
+ / ``'OFF'``. A value of ``None`` for a config option can be used to clear out a
290
+ previously set value.
291
+ """
292
+
293
+ _set_gdal_config_options(options)
294
+
295
+
296
+ def get_gdal_config_option(name):
297
+ """Get the value for a GDAL configuration option.
298
+
299
+ Parameters
300
+ ----------
301
+ name : str
302
+ name of the option to retrive
303
+
304
+ Returns
305
+ -------
306
+ value of the option or None if not set
307
+ ``'ON'`` / ``'OFF'`` are normalized to ``True`` / ``False``.
308
+ """
309
+
310
+ return _get_gdal_config_option(name)
311
+
312
+
313
+ def get_gdal_data_path():
314
+ """Get the path to the directory GDAL uses to read data files.
315
+
316
+ Returns
317
+ -------
318
+ str, or None if data directory was not found
319
+ """
320
+ return _get_gdal_data_path()
pyogrio/errors.py ADDED
@@ -0,0 +1,32 @@
1
+ class DataSourceError(RuntimeError):
2
+ """Errors relating to opening or closing an OGRDataSource (with >= 1 layers)"""
3
+
4
+ pass
5
+
6
+
7
+ class DataLayerError(RuntimeError):
8
+ """Errors relating to working with a single OGRLayer"""
9
+
10
+ pass
11
+
12
+
13
+ class CRSError(DataLayerError):
14
+ """Errors relating to getting or setting CRS values"""
15
+
16
+ pass
17
+
18
+
19
+ class FeatureError(DataLayerError):
20
+ """Errors related to reading or writing a feature"""
21
+
22
+ pass
23
+
24
+
25
+ class GeometryError(DataLayerError):
26
+ """Errors relating to getting or setting a geometry field"""
27
+
28
+ pass
29
+
30
+
31
+ class FieldError(DataLayerError):
32
+ """Errors relating to getting or setting a non-geometry field"""
@@ -0,0 +1,19 @@
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_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libgdal.so.34.3.8.5"
12
+ IMPORTED_SONAME_RELEASE "libgdal.so.34"
13
+ )
14
+
15
+ list(APPEND _cmake_import_check_targets GDAL::GDAL )
16
+ list(APPEND _cmake_import_check_files_for_GDAL::GDAL "${_IMPORT_PREFIX}/lib/libgdal.so.34.3.8.5" )
17
+
18
+ # Commands beyond this point should not need to know the version.
19
+ 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.27)
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,25 @@
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}/../../../arm64-linux-release" 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
+ find_dependency(Threads)
17
+ find_dependency(PROJ 9 CONFIG)
18
+
19
+ if(DEFINED _gdal_module_path_backup)
20
+ set(CMAKE_MODULE_PATH "${_gdal_module_path_backup}")
21
+ else()
22
+ unset(CMAKE_MODULE_PATH)
23
+ endif()
24
+ endif()
25
+ 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.8.5")
14
+
15
+ if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
16
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
17
+ else()
18
+
19
+ if("3.8.5" 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.8.5")
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()