pyogrio 0.8.0__cp312-cp312-manylinux_2_28_aarch64.whl → 0.10.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.
- pyogrio/__init__.py +20 -13
- pyogrio/_compat.py +7 -1
- pyogrio/_env.py +4 -6
- pyogrio/_err.cpython-312-aarch64-linux-gnu.so +0 -0
- pyogrio/_geometry.cpython-312-aarch64-linux-gnu.so +0 -0
- pyogrio/_io.cpython-312-aarch64-linux-gnu.so +0 -0
- pyogrio/_ogr.cpython-312-aarch64-linux-gnu.so +0 -0
- pyogrio/_version.py +3 -3
- pyogrio/_vsi.cpython-312-aarch64-linux-gnu.so +0 -0
- pyogrio/core.py +86 -20
- pyogrio/errors.py +9 -16
- pyogrio/gdal_data/GDAL-targets-release.cmake +3 -3
- pyogrio/gdal_data/GDAL-targets.cmake +1 -1
- pyogrio/gdal_data/GDALConfig.cmake +0 -1
- pyogrio/gdal_data/GDALConfigVersion.cmake +3 -3
- pyogrio/gdal_data/MM_m_idofic.csv +321 -0
- pyogrio/gdal_data/gdaltileindex.xsd +269 -0
- pyogrio/gdal_data/gdalvrt.xsd +130 -22
- pyogrio/gdal_data/ogrinfo_output.schema.json +23 -0
- pyogrio/gdal_data/ogrvrt.xsd +3 -0
- pyogrio/gdal_data/pci_datum.txt +222 -155
- pyogrio/gdal_data/pci_ellips.txt +90 -38
- pyogrio/gdal_data/vcpkg.spdx.json +27 -27
- pyogrio/gdal_data/vcpkg_abi_info.txt +25 -25
- pyogrio/geopandas.py +44 -27
- pyogrio/proj_data/proj-config-version.cmake +2 -2
- pyogrio/proj_data/proj-targets.cmake +1 -1
- pyogrio/proj_data/proj.db +0 -0
- pyogrio/proj_data/proj4-targets.cmake +1 -1
- pyogrio/proj_data/projjson.schema.json +1 -1
- pyogrio/proj_data/vcpkg.spdx.json +21 -21
- pyogrio/proj_data/vcpkg_abi_info.txt +13 -13
- pyogrio/raw.py +46 -30
- pyogrio/tests/conftest.py +206 -12
- pyogrio/tests/fixtures/README.md +32 -13
- pyogrio/tests/fixtures/curve.gpkg +0 -0
- pyogrio/tests/fixtures/{test_multisurface.gpkg → curvepolygon.gpkg} +0 -0
- pyogrio/tests/fixtures/line_zm.gpkg +0 -0
- pyogrio/tests/fixtures/multisurface.gpkg +0 -0
- pyogrio/tests/test_arrow.py +178 -24
- pyogrio/tests/test_core.py +162 -72
- pyogrio/tests/test_geopandas_io.py +341 -96
- pyogrio/tests/test_path.py +30 -17
- pyogrio/tests/test_raw_io.py +165 -54
- pyogrio/tests/test_util.py +56 -0
- pyogrio/util.py +55 -31
- {pyogrio-0.8.0.dist-info → pyogrio-0.10.0.dist-info}/LICENSE +1 -1
- {pyogrio-0.8.0.dist-info → pyogrio-0.10.0.dist-info}/METADATA +37 -8
- {pyogrio-0.8.0.dist-info → pyogrio-0.10.0.dist-info}/RECORD +203 -218
- {pyogrio-0.8.0.dist-info → pyogrio-0.10.0.dist-info}/WHEEL +1 -1
- pyogrio.libs/{libgdal-b2fb2022.so.34.3.8.5 → libgdal-b0847c7b.so.35.3.9.1} +0 -0
- pyogrio/_err.pxd +0 -4
- pyogrio/_err.pyx +0 -250
- pyogrio/_geometry.pxd +0 -4
- pyogrio/_geometry.pyx +0 -129
- pyogrio/_io.pxd +0 -0
- pyogrio/_io.pyx +0 -2738
- pyogrio/_ogr.pxd +0 -441
- pyogrio/_ogr.pyx +0 -346
- pyogrio/_vsi.pxd +0 -4
- pyogrio/_vsi.pyx +0 -140
- pyogrio/arrow_bridge.h +0 -115
- pyogrio/gdal_data/bag_template.xml +0 -201
- pyogrio/gdal_data/gmlasconf.xml +0 -169
- pyogrio/gdal_data/gmlasconf.xsd +0 -1066
- pyogrio/gdal_data/netcdf_config.xsd +0 -143
- pyogrio/gdal_data/template_tiles.mapml +0 -28
- pyogrio/tests/fixtures/test_datetime.geojson +0 -7
- pyogrio/tests/fixtures/test_datetime_tz.geojson +0 -8
- pyogrio/tests/fixtures/test_fgdb.gdb.zip +0 -0
- pyogrio/tests/fixtures/test_nested.geojson +0 -18
- pyogrio/tests/fixtures/test_ogr_types_list.geojson +0 -12
- {pyogrio-0.8.0.dist-info → pyogrio-0.10.0.dist-info}/top_level.txt +0 -0
pyogrio/util.py
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
"""Utility functions."""
|
|
2
|
+
|
|
2
3
|
import re
|
|
3
4
|
import sys
|
|
5
|
+
from packaging.version import Version
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Union
|
|
4
8
|
from urllib.parse import urlparse
|
|
5
9
|
|
|
6
|
-
from
|
|
10
|
+
from pyogrio._vsi import vsimem_rmtree_toplevel as _vsimem_rmtree_toplevel
|
|
7
11
|
|
|
8
12
|
|
|
9
13
|
def get_vsi_path_or_buffer(path_or_buffer):
|
|
10
|
-
"""Get
|
|
14
|
+
"""Get VSI-prefixed path or bytes buffer depending on type of path_or_buffer.
|
|
11
15
|
|
|
12
16
|
If path_or_buffer is a bytes object, it will be returned directly and will
|
|
13
17
|
be read into an in-memory dataset when passed to one of the Cython functions.
|
|
@@ -21,15 +25,17 @@ def get_vsi_path_or_buffer(path_or_buffer):
|
|
|
21
25
|
Parameters
|
|
22
26
|
----------
|
|
23
27
|
path_or_buffer : str, pathlib.Path, bytes, or file-like
|
|
28
|
+
A dataset path or URI, raw buffer, or file-like object with a read method.
|
|
24
29
|
|
|
25
30
|
Returns
|
|
26
31
|
-------
|
|
27
32
|
str or bytes
|
|
28
|
-
"""
|
|
29
33
|
|
|
30
|
-
|
|
34
|
+
"""
|
|
35
|
+
# treat Path objects here already to ignore their read method + to avoid backslashes
|
|
36
|
+
# on Windows.
|
|
31
37
|
if isinstance(path_or_buffer, Path):
|
|
32
|
-
return vsi_path(
|
|
38
|
+
return vsi_path(path_or_buffer)
|
|
33
39
|
|
|
34
40
|
if isinstance(path_or_buffer, bytes):
|
|
35
41
|
return path_or_buffer
|
|
@@ -38,7 +44,7 @@ def get_vsi_path_or_buffer(path_or_buffer):
|
|
|
38
44
|
bytes_buffer = path_or_buffer.read()
|
|
39
45
|
|
|
40
46
|
# rewind buffer if possible so that subsequent operations do not need to rewind
|
|
41
|
-
if hasattr(path_or_buffer, "
|
|
47
|
+
if hasattr(path_or_buffer, "seekable") and path_or_buffer.seekable():
|
|
42
48
|
path_or_buffer.seek(0)
|
|
43
49
|
|
|
44
50
|
return bytes_buffer
|
|
@@ -46,16 +52,14 @@ def get_vsi_path_or_buffer(path_or_buffer):
|
|
|
46
52
|
return vsi_path(str(path_or_buffer))
|
|
47
53
|
|
|
48
54
|
|
|
49
|
-
def vsi_path(path: str) -> str:
|
|
50
|
-
"""
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"path cannot contain /vsimem/ directly; to use an in-memory dataset a bytes object must be passed instead"
|
|
58
|
-
)
|
|
55
|
+
def vsi_path(path: Union[str, Path]) -> str:
|
|
56
|
+
"""Ensure path is a local path or a GDAL-compatible VSI path."""
|
|
57
|
+
# Convert Path objects to string, but for VSI paths, keep posix style path.
|
|
58
|
+
if isinstance(path, Path):
|
|
59
|
+
if sys.platform == "win32" and path.as_posix().startswith("/vsi"):
|
|
60
|
+
path = path.as_posix()
|
|
61
|
+
else:
|
|
62
|
+
path = str(path)
|
|
59
63
|
|
|
60
64
|
# path is already in GDAL format
|
|
61
65
|
if path.startswith("/vsi"):
|
|
@@ -98,12 +102,11 @@ SCHEMES = {
|
|
|
98
102
|
# those are for now not added as supported URI
|
|
99
103
|
}
|
|
100
104
|
|
|
101
|
-
CURLSCHEMES =
|
|
105
|
+
CURLSCHEMES = {k for k, v in SCHEMES.items() if v == "curl"}
|
|
102
106
|
|
|
103
107
|
|
|
104
108
|
def _parse_uri(path: str):
|
|
105
|
-
"""
|
|
106
|
-
Parse a URI
|
|
109
|
+
"""Parse a URI.
|
|
107
110
|
|
|
108
111
|
Returns a tuples of (path, archive, scheme)
|
|
109
112
|
|
|
@@ -115,7 +118,7 @@ def _parse_uri(path: str):
|
|
|
115
118
|
scheme : str
|
|
116
119
|
URI scheme such as "https" or "zip+s3".
|
|
117
120
|
"""
|
|
118
|
-
parts = urlparse(path)
|
|
121
|
+
parts = urlparse(path, allow_fragments=False)
|
|
119
122
|
|
|
120
123
|
# if the scheme is not one of GDAL's supported schemes, return raw path
|
|
121
124
|
if parts.scheme and not all(p in SCHEMES for p in parts.scheme.split("+")):
|
|
@@ -138,8 +141,7 @@ def _parse_uri(path: str):
|
|
|
138
141
|
|
|
139
142
|
|
|
140
143
|
def _construct_vsi_path(path, archive, scheme) -> str:
|
|
141
|
-
"""Convert a parsed path to a GDAL VSI path"""
|
|
142
|
-
|
|
144
|
+
"""Convert a parsed path to a GDAL VSI path."""
|
|
143
145
|
prefix = ""
|
|
144
146
|
suffix = ""
|
|
145
147
|
schemes = scheme.split("+")
|
|
@@ -148,9 +150,7 @@ def _construct_vsi_path(path, archive, scheme) -> str:
|
|
|
148
150
|
schemes.insert(0, "zip")
|
|
149
151
|
|
|
150
152
|
if schemes:
|
|
151
|
-
prefix = "/".join(
|
|
152
|
-
"vsi{0}".format(SCHEMES[p]) for p in schemes if p and p != "file"
|
|
153
|
-
)
|
|
153
|
+
prefix = "/".join(f"vsi{SCHEMES[p]}" for p in schemes if p and p != "file")
|
|
154
154
|
|
|
155
155
|
if schemes[-1] in CURLSCHEMES:
|
|
156
156
|
suffix = f"{schemes[-1]}://"
|
|
@@ -159,15 +159,15 @@ def _construct_vsi_path(path, archive, scheme) -> str:
|
|
|
159
159
|
if archive:
|
|
160
160
|
return "/{}/{}{}/{}".format(prefix, suffix, archive, path.lstrip("/"))
|
|
161
161
|
else:
|
|
162
|
-
return "/{}/{}{}"
|
|
162
|
+
return f"/{prefix}/{suffix}{path}"
|
|
163
163
|
|
|
164
164
|
return path
|
|
165
165
|
|
|
166
166
|
|
|
167
167
|
def _preprocess_options_key_value(options):
|
|
168
|
-
"""
|
|
169
|
-
|
|
170
|
-
to `SPATIAL_INDEX="YES"`.
|
|
168
|
+
"""Preprocess options.
|
|
169
|
+
|
|
170
|
+
For example, `spatial_index=True` gets converted to `SPATIAL_INDEX="YES"`.
|
|
171
171
|
"""
|
|
172
172
|
if not isinstance(options, dict):
|
|
173
173
|
raise TypeError(f"Expected options to be a dict, got {type(options)}")
|
|
@@ -191,6 +191,7 @@ def _mask_to_wkb(mask):
|
|
|
191
191
|
Parameters
|
|
192
192
|
----------
|
|
193
193
|
mask : Shapely geometry
|
|
194
|
+
The geometry to convert to WKB.
|
|
194
195
|
|
|
195
196
|
Returns
|
|
196
197
|
-------
|
|
@@ -201,8 +202,8 @@ def _mask_to_wkb(mask):
|
|
|
201
202
|
ValueError
|
|
202
203
|
raised if Shapely >= 2.0 is not available or mask is not a Shapely
|
|
203
204
|
Geometry object
|
|
204
|
-
"""
|
|
205
205
|
|
|
206
|
+
"""
|
|
206
207
|
if mask is None:
|
|
207
208
|
return mask
|
|
208
209
|
|
|
@@ -221,3 +222,26 @@ def _mask_to_wkb(mask):
|
|
|
221
222
|
raise ValueError("'mask' parameter must be a Shapely geometry")
|
|
222
223
|
|
|
223
224
|
return shapely.to_wkb(mask)
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
def vsimem_rmtree_toplevel(path: Union[str, Path]):
|
|
228
|
+
"""Remove the parent directory of the file path recursively.
|
|
229
|
+
|
|
230
|
+
This is used for final cleanup of an in-memory dataset, which may have been
|
|
231
|
+
created within a directory to contain sibling files.
|
|
232
|
+
|
|
233
|
+
Additional VSI handlers may be chained to the left of /vsimem/ in path and
|
|
234
|
+
will be ignored.
|
|
235
|
+
|
|
236
|
+
Remark: function is defined here to be able to run tests on it.
|
|
237
|
+
|
|
238
|
+
Parameters
|
|
239
|
+
----------
|
|
240
|
+
path : str or pathlib.Path
|
|
241
|
+
path to in-memory file
|
|
242
|
+
|
|
243
|
+
"""
|
|
244
|
+
if isinstance(path, Path):
|
|
245
|
+
path = path.as_posix()
|
|
246
|
+
|
|
247
|
+
_vsimem_rmtree_toplevel(path)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2020-
|
|
3
|
+
Copyright (c) 2020-2024 Brendan C. Ward and pyogrio contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1,12 +1,41 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyogrio
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10.0
|
|
4
4
|
Summary: Vectorized spatial vector file format I/O using GDAL/OGR
|
|
5
|
-
|
|
6
|
-
Author: Brendan C. Ward
|
|
7
|
-
|
|
8
|
-
License: MIT
|
|
9
|
-
|
|
5
|
+
Author: pyogrio contributors
|
|
6
|
+
Author-email: "Brendan C. Ward" <bcward@astutespruce.com>
|
|
7
|
+
Maintainer: pyogrio contributors
|
|
8
|
+
License: MIT License
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2020-2024 Brendan C. Ward and pyogrio contributors
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
SOFTWARE.
|
|
29
|
+
|
|
30
|
+
Project-URL: Home, https://pyogrio.readthedocs.io/
|
|
31
|
+
Project-URL: Repository, https://github.com/geopandas/pyogrio
|
|
32
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
33
|
+
Classifier: Intended Audience :: Science/Research
|
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
+
Classifier: Operating System :: OS Independent
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
38
|
+
Requires-Python: >=3.9
|
|
10
39
|
Description-Content-Type: text/markdown
|
|
11
40
|
License-File: LICENSE
|
|
12
41
|
Requires-Dist: certifi
|
|
@@ -15,7 +44,7 @@ Requires-Dist: packaging
|
|
|
15
44
|
Provides-Extra: benchmark
|
|
16
45
|
Requires-Dist: pytest-benchmark ; extra == 'benchmark'
|
|
17
46
|
Provides-Extra: dev
|
|
18
|
-
Requires-Dist:
|
|
47
|
+
Requires-Dist: cython ; extra == 'dev'
|
|
19
48
|
Provides-Extra: geopandas
|
|
20
49
|
Requires-Dist: geopandas ; extra == 'geopandas'
|
|
21
50
|
Provides-Extra: test
|
|
@@ -56,7 +85,7 @@ substantial change. Please see [CHANGES](CHANGES.md).
|
|
|
56
85
|
|
|
57
86
|
## Requirements
|
|
58
87
|
|
|
59
|
-
Supports Python 3.
|
|
88
|
+
Supports Python 3.9 - 3.13 and GDAL 3.4.x - 3.9.x.
|
|
60
89
|
|
|
61
90
|
Reading to GeoDataFrames requires `geopandas>=0.12` with `shapely>=2`.
|
|
62
91
|
|