pyogrio 0.9.0__cp311-cp311-macosx_12_0_arm64.whl → 0.10.0__cp311-cp311-macosx_12_0_arm64.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 (74) hide show
  1. pyogrio/.dylibs/{libgdal.34.3.8.5.dylib → libgdal.35.3.9.1.dylib} +0 -0
  2. pyogrio/__init__.py +20 -13
  3. pyogrio/_compat.py +7 -1
  4. pyogrio/_env.py +4 -6
  5. pyogrio/_err.cpython-311-darwin.so +0 -0
  6. pyogrio/_geometry.cpython-311-darwin.so +0 -0
  7. pyogrio/_io.cpython-311-darwin.so +0 -0
  8. pyogrio/_ogr.cpython-311-darwin.so +0 -0
  9. pyogrio/_version.py +3 -3
  10. pyogrio/_vsi.cpython-311-darwin.so +0 -0
  11. pyogrio/core.py +86 -20
  12. pyogrio/errors.py +9 -16
  13. pyogrio/gdal_data/GDAL-targets-release.cmake +3 -3
  14. pyogrio/gdal_data/GDAL-targets.cmake +1 -1
  15. pyogrio/gdal_data/GDALConfig.cmake +0 -1
  16. pyogrio/gdal_data/GDALConfigVersion.cmake +3 -3
  17. pyogrio/gdal_data/MM_m_idofic.csv +321 -0
  18. pyogrio/gdal_data/gdaltileindex.xsd +269 -0
  19. pyogrio/gdal_data/gdalvrt.xsd +130 -22
  20. pyogrio/gdal_data/ogrinfo_output.schema.json +23 -0
  21. pyogrio/gdal_data/ogrvrt.xsd +3 -0
  22. pyogrio/gdal_data/pci_datum.txt +222 -155
  23. pyogrio/gdal_data/pci_ellips.txt +90 -38
  24. pyogrio/gdal_data/vcpkg.spdx.json +21 -21
  25. pyogrio/gdal_data/vcpkg_abi_info.txt +26 -26
  26. pyogrio/geopandas.py +32 -24
  27. pyogrio/proj_data/proj-config-version.cmake +2 -2
  28. pyogrio/proj_data/proj-targets.cmake +1 -1
  29. pyogrio/proj_data/proj.db +0 -0
  30. pyogrio/proj_data/proj4-targets.cmake +1 -1
  31. pyogrio/proj_data/projjson.schema.json +1 -1
  32. pyogrio/proj_data/vcpkg.spdx.json +17 -17
  33. pyogrio/proj_data/vcpkg_abi_info.txt +14 -14
  34. pyogrio/raw.py +46 -30
  35. pyogrio/tests/conftest.py +206 -12
  36. pyogrio/tests/fixtures/README.md +32 -13
  37. pyogrio/tests/fixtures/curve.gpkg +0 -0
  38. pyogrio/tests/fixtures/{test_multisurface.gpkg → curvepolygon.gpkg} +0 -0
  39. pyogrio/tests/fixtures/line_zm.gpkg +0 -0
  40. pyogrio/tests/fixtures/multisurface.gpkg +0 -0
  41. pyogrio/tests/test_arrow.py +178 -24
  42. pyogrio/tests/test_core.py +162 -72
  43. pyogrio/tests/test_geopandas_io.py +239 -99
  44. pyogrio/tests/test_path.py +29 -17
  45. pyogrio/tests/test_raw_io.py +165 -54
  46. pyogrio/tests/test_util.py +56 -0
  47. pyogrio/util.py +54 -30
  48. {pyogrio-0.9.0.dist-info → pyogrio-0.10.0.dist-info}/LICENSE +1 -1
  49. {pyogrio-0.9.0.dist-info → pyogrio-0.10.0.dist-info}/METADATA +37 -8
  50. {pyogrio-0.9.0.dist-info → pyogrio-0.10.0.dist-info}/RECORD +52 -68
  51. {pyogrio-0.9.0.dist-info → pyogrio-0.10.0.dist-info}/WHEEL +1 -1
  52. pyogrio/_err.pxd +0 -4
  53. pyogrio/_err.pyx +0 -250
  54. pyogrio/_geometry.pxd +0 -4
  55. pyogrio/_geometry.pyx +0 -129
  56. pyogrio/_io.pxd +0 -0
  57. pyogrio/_io.pyx +0 -2742
  58. pyogrio/_ogr.pxd +0 -444
  59. pyogrio/_ogr.pyx +0 -346
  60. pyogrio/_vsi.pxd +0 -4
  61. pyogrio/_vsi.pyx +0 -140
  62. pyogrio/arrow_bridge.h +0 -115
  63. pyogrio/gdal_data/bag_template.xml +0 -201
  64. pyogrio/gdal_data/gmlasconf.xml +0 -169
  65. pyogrio/gdal_data/gmlasconf.xsd +0 -1066
  66. pyogrio/gdal_data/netcdf_config.xsd +0 -143
  67. pyogrio/gdal_data/template_tiles.mapml +0 -28
  68. pyogrio/tests/fixtures/poly_not_enough_points.shp.zip +0 -0
  69. pyogrio/tests/fixtures/test_datetime.geojson +0 -7
  70. pyogrio/tests/fixtures/test_datetime_tz.geojson +0 -8
  71. pyogrio/tests/fixtures/test_fgdb.gdb.zip +0 -0
  72. pyogrio/tests/fixtures/test_nested.geojson +0 -18
  73. pyogrio/tests/fixtures/test_ogr_types_list.geojson +0 -12
  74. {pyogrio-0.9.0.dist-info → pyogrio-0.10.0.dist-info}/top_level.txt +0 -0
pyogrio/_err.pyx DELETED
@@ -1,250 +0,0 @@
1
- # ported from fiona::_err.pyx
2
- from enum import IntEnum
3
- import warnings
4
-
5
- from pyogrio._ogr cimport (
6
- CE_None, CE_Debug, CE_Warning, CE_Failure, CE_Fatal, CPLErrorReset,
7
- CPLGetLastErrorType, CPLGetLastErrorNo, CPLGetLastErrorMsg, OGRErr,
8
- CPLErr, CPLErrorHandler, CPLDefaultErrorHandler, CPLPushErrorHandler)
9
-
10
-
11
- # CPL Error types as an enum.
12
- class GDALError(IntEnum):
13
- none = CE_None
14
- debug = CE_Debug
15
- warning = CE_Warning
16
- failure = CE_Failure
17
- fatal = CE_Fatal
18
-
19
-
20
-
21
- class CPLE_BaseError(Exception):
22
- """Base CPL error class.
23
- For internal use within Cython only.
24
- """
25
-
26
- def __init__(self, error, errno, errmsg):
27
- self.error = error
28
- self.errno = errno
29
- self.errmsg = errmsg
30
-
31
- def __str__(self):
32
- return self.__unicode__()
33
-
34
- def __unicode__(self):
35
- return u"{}".format(self.errmsg)
36
-
37
- @property
38
- def args(self):
39
- return self.error, self.errno, self.errmsg
40
-
41
-
42
- class CPLE_AppDefinedError(CPLE_BaseError):
43
- pass
44
-
45
-
46
- class CPLE_OutOfMemoryError(CPLE_BaseError):
47
- pass
48
-
49
-
50
- class CPLE_FileIOError(CPLE_BaseError):
51
- pass
52
-
53
-
54
- class CPLE_OpenFailedError(CPLE_BaseError):
55
- pass
56
-
57
-
58
- class CPLE_IllegalArgError(CPLE_BaseError):
59
- pass
60
-
61
-
62
- class CPLE_NotSupportedError(CPLE_BaseError):
63
- pass
64
-
65
-
66
- class CPLE_AssertionFailedError(CPLE_BaseError):
67
- pass
68
-
69
-
70
- class CPLE_NoWriteAccessError(CPLE_BaseError):
71
- pass
72
-
73
-
74
- class CPLE_UserInterruptError(CPLE_BaseError):
75
- pass
76
-
77
-
78
- class ObjectNullError(CPLE_BaseError):
79
- pass
80
-
81
-
82
- class CPLE_HttpResponseError(CPLE_BaseError):
83
- pass
84
-
85
-
86
- class CPLE_AWSBucketNotFoundError(CPLE_BaseError):
87
- pass
88
-
89
-
90
- class CPLE_AWSObjectNotFoundError(CPLE_BaseError):
91
- pass
92
-
93
-
94
- class CPLE_AWSAccessDeniedError(CPLE_BaseError):
95
- pass
96
-
97
-
98
- class CPLE_AWSInvalidCredentialsError(CPLE_BaseError):
99
- pass
100
-
101
-
102
- class CPLE_AWSSignatureDoesNotMatchError(CPLE_BaseError):
103
- pass
104
-
105
-
106
- class NullPointerError(CPLE_BaseError):
107
- """
108
- Returned from exc_wrap_pointer when a NULL pointer is passed, but no GDAL
109
- error was raised.
110
- """
111
- pass
112
-
113
-
114
-
115
- # Map of GDAL error numbers to the Python exceptions.
116
- exception_map = {
117
- 1: CPLE_AppDefinedError,
118
- 2: CPLE_OutOfMemoryError,
119
- 3: CPLE_FileIOError,
120
- 4: CPLE_OpenFailedError,
121
- 5: CPLE_IllegalArgError,
122
- 6: CPLE_NotSupportedError,
123
- 7: CPLE_AssertionFailedError,
124
- 8: CPLE_NoWriteAccessError,
125
- 9: CPLE_UserInterruptError,
126
- 10: ObjectNullError,
127
-
128
- # error numbers 11-16 are introduced in GDAL 2.1. See
129
- # https://github.com/OSGeo/gdal/pull/98.
130
- 11: CPLE_HttpResponseError,
131
- 12: CPLE_AWSBucketNotFoundError,
132
- 13: CPLE_AWSObjectNotFoundError,
133
- 14: CPLE_AWSAccessDeniedError,
134
- 15: CPLE_AWSInvalidCredentialsError,
135
- 16: CPLE_AWSSignatureDoesNotMatchError
136
- }
137
-
138
-
139
- cdef inline object exc_check():
140
- """Checks GDAL error stack for fatal or non-fatal errors
141
- Returns
142
- -------
143
- An Exception, SystemExit, or None
144
- """
145
- cdef const char *msg_c = NULL
146
-
147
- err_type = CPLGetLastErrorType()
148
- err_no = CPLGetLastErrorNo()
149
- err_msg = CPLGetLastErrorMsg()
150
-
151
- if err_msg == NULL:
152
- msg = "No error message."
153
- else:
154
- # Reformat messages.
155
- msg_b = err_msg
156
-
157
- try:
158
- msg = msg_b.decode('utf-8')
159
- msg = msg.replace("`", "'")
160
- msg = msg.replace("\n", " ")
161
- except UnicodeDecodeError as exc:
162
- msg = f"Could not decode error message to UTF-8. Raw error: {msg_b}"
163
-
164
- if err_type == 3:
165
- CPLErrorReset()
166
- return exception_map.get(
167
- err_no, CPLE_BaseError)(err_type, err_no, msg)
168
-
169
- if err_type == 4:
170
- return SystemExit("Fatal error: {0}".format((err_type, err_no, msg)))
171
-
172
- else:
173
- return
174
-
175
-
176
- cdef void *exc_wrap_pointer(void *ptr) except NULL:
177
- """Wrap a GDAL/OGR function that returns GDALDatasetH etc (void *)
178
- Raises an exception if a non-fatal error has be set or if pointer is NULL.
179
- """
180
- if ptr == NULL:
181
- exc = exc_check()
182
- if exc:
183
- raise exc
184
- else:
185
- # null pointer was passed, but no error message from GDAL
186
- raise NullPointerError(-1, -1, "NULL pointer error")
187
- return ptr
188
-
189
-
190
- cdef int exc_wrap_int(int err) except -1:
191
- """Wrap a GDAL/OGR function that returns CPLErr or OGRErr (int)
192
- Raises an exception if a non-fatal error has be set.
193
-
194
- Copied from Fiona (_err.pyx).
195
- """
196
- if err:
197
- exc = exc_check()
198
- if exc:
199
- raise exc
200
- else:
201
- # no error message from GDAL
202
- raise CPLE_BaseError(-1, -1, "Unspecified OGR / GDAL error")
203
- return err
204
-
205
-
206
- cdef int exc_wrap_ogrerr(int err) except -1:
207
- """Wrap a function that returns OGRErr (int) but does not use the
208
- CPL error stack.
209
-
210
- Adapted from Fiona (_err.pyx).
211
- """
212
- if err != 0:
213
- raise CPLE_BaseError(3, err, f"OGR Error code {err}")
214
-
215
- return err
216
-
217
-
218
- cdef void error_handler(CPLErr err_class, int err_no, const char* err_msg) nogil:
219
- """Custom CPL error handler to match the Python behaviour.
220
-
221
- Generally we want to suppress error printing to stderr (behaviour of the
222
- default GDAL error handler) because we already raise a Python exception
223
- that includes the error message.
224
- """
225
- if err_class == CE_Fatal:
226
- # If the error class is CE_Fatal, we want to have a message issued
227
- # because the CPL support code does an abort() before any exception
228
- # can be generated
229
- CPLDefaultErrorHandler(err_class, err_no, err_msg)
230
- return
231
-
232
- elif err_class == CE_Failure:
233
- # For Failures, do nothing as those are explicitly caught
234
- # with error return codes and translated into Python exceptions
235
- return
236
-
237
- elif err_class == CE_Warning:
238
- with gil:
239
- msg_b = err_msg
240
- msg = msg_b.decode('utf-8')
241
- warnings.warn(msg, RuntimeWarning)
242
- return
243
-
244
- # Fall back to the default handler for non-failure messages since
245
- # they won't be translated into exceptions.
246
- CPLDefaultErrorHandler(err_class, err_no, err_msg)
247
-
248
-
249
- def _register_error_handler():
250
- CPLPushErrorHandler(<CPLErrorHandler>error_handler)
pyogrio/_geometry.pxd DELETED
@@ -1,4 +0,0 @@
1
- from pyogrio._ogr cimport *
2
-
3
- cdef str get_geometry_type(void *ogr_layer)
4
- cdef OGRwkbGeometryType get_geometry_type_code(str geometry_type) except *
pyogrio/_geometry.pyx DELETED
@@ -1,129 +0,0 @@
1
- import warnings
2
- from pyogrio._ogr cimport *
3
- from pyogrio._err cimport *
4
- from pyogrio._err import CPLE_BaseError, NullPointerError
5
- from pyogrio.errors import DataLayerError, GeometryError
6
-
7
-
8
- # Mapping of OGR integer geometry types to GeoJSON type names.
9
-
10
- GEOMETRY_TYPES = {
11
- wkbUnknown: 'Unknown',
12
- wkbPoint: 'Point',
13
- wkbLineString: 'LineString',
14
- wkbPolygon: 'Polygon',
15
- wkbMultiPoint: 'MultiPoint',
16
- wkbMultiLineString: 'MultiLineString',
17
- wkbMultiPolygon: 'MultiPolygon',
18
- wkbGeometryCollection: 'GeometryCollection',
19
- wkbNone: None,
20
- wkbLinearRing: 'LinearRing',
21
- # WARNING: Measured types are not supported in GEOS and downstream uses
22
- # these are stripped automatically to their corresponding 2D / 3D types
23
- wkbPointM: 'PointM',
24
- wkbLineStringM: 'Measured LineString',
25
- wkbPolygonM: 'Measured Polygon',
26
- wkbMultiPointM: 'Measured MultiPoint',
27
- wkbMultiLineStringM: 'Measured MultiLineString',
28
- wkbMultiPolygonM: 'Measured MultiPolygon',
29
- wkbGeometryCollectionM: 'Measured GeometryCollection',
30
- wkbPointZM: 'Measured 3D Point',
31
- wkbLineStringZM: 'Measured 3D LineString',
32
- wkbPolygonZM: 'Measured 3D Polygon',
33
- wkbMultiPointZM: 'Measured 3D MultiPoint',
34
- wkbMultiLineStringZM: 'Measured 3D MultiLineString',
35
- wkbMultiPolygonZM: 'Measured 3D MultiPolygon',
36
- wkbGeometryCollectionZM: 'Measured 3D GeometryCollection',
37
- wkbPoint25D: 'Point Z',
38
- wkbLineString25D: 'LineString Z',
39
- wkbPolygon25D: 'Polygon Z',
40
- wkbMultiPoint25D: 'MultiPoint Z',
41
- wkbMultiLineString25D: 'MultiLineString Z',
42
- wkbMultiPolygon25D: 'MultiPolygon Z',
43
- wkbGeometryCollection25D: 'GeometryCollection Z',
44
- }
45
-
46
- GEOMETRY_TYPE_CODES = {v:k for k, v in GEOMETRY_TYPES.items()}
47
-
48
- # add additional aliases from 2.5D format
49
- GEOMETRY_TYPE_CODES.update({
50
- '2.5D Point': wkbPoint25D,
51
- '2.5D LineString': wkbLineString25D,
52
- '2.5D Polygon': wkbPolygon25D,
53
- '2.5D MultiPoint': wkbMultiPoint25D,
54
- '2.5D MultiLineString': wkbMultiLineString25D,
55
- '2.5D MultiPolygon': wkbMultiPolygon25D,
56
- '2.5D GeometryCollection': wkbGeometryCollection25D
57
- })
58
-
59
- # 2.5D also represented using negative numbers not enumerated above
60
- GEOMETRY_TYPES.update({
61
- -2147483647: 'Point Z',
62
- -2147483646: 'LineString Z',
63
- -2147483645: 'Polygon Z',
64
- -2147483644: 'MultiPoint Z',
65
- -2147483643: 'MultiLineString Z',
66
- -2147483642: 'MultiPolygon Z',
67
- -2147483641: 'GeometryCollection Z',
68
- })
69
-
70
-
71
- cdef str get_geometry_type(void *ogr_layer):
72
- """Get geometry type for layer.
73
-
74
- Parameters
75
- ----------
76
- ogr_layer : pointer to open OGR layer
77
-
78
- Returns
79
- -------
80
- str
81
- geometry type
82
- """
83
- cdef void *cogr_featuredef = NULL
84
- cdef OGRwkbGeometryType ogr_type
85
-
86
- try:
87
- ogr_featuredef = exc_wrap_pointer(OGR_L_GetLayerDefn(ogr_layer))
88
- except NullPointerError:
89
- raise DataLayerError("Could not get layer definition")
90
-
91
- except CPLE_BaseError as exc:
92
- raise DataLayerError(str(exc))
93
-
94
- ogr_type = OGR_FD_GetGeomType(ogr_featuredef)
95
-
96
- if ogr_type not in GEOMETRY_TYPES:
97
- raise GeometryError(f"Geometry type is not supported: {ogr_type}")
98
-
99
- if OGR_GT_HasM(ogr_type):
100
- original_type = GEOMETRY_TYPES[ogr_type]
101
-
102
- # Downgrade the type to 2D / 3D
103
- ogr_type = OGR_GT_SetModifier(ogr_type, OGR_GT_HasZ(ogr_type), 0)
104
-
105
- # TODO: review; this might be annoying...
106
- warnings.warn(
107
- "Measured (M) geometry types are not supported. "
108
- f"Original type '{original_type}' "
109
- f"is converted to '{GEOMETRY_TYPES[ogr_type]}'")
110
-
111
- return GEOMETRY_TYPES[ogr_type]
112
-
113
-
114
- cdef OGRwkbGeometryType get_geometry_type_code(str geometry_type) except *:
115
- """Get geometry type code for string geometry type.
116
-
117
- Parameters
118
- ----------
119
- geometry_type : str
120
-
121
- Returns
122
- -------
123
- int
124
- geometry type code
125
- """
126
- if geometry_type not in GEOMETRY_TYPE_CODES:
127
- raise GeometryError(f"Geometry type is not supported: {geometry_type}")
128
-
129
- return GEOMETRY_TYPE_CODES[geometry_type]
pyogrio/_io.pxd DELETED
File without changes