pyogrio 0.8.0__cp39-cp39-manylinux_2_28_aarch64.whl → 0.10.0__cp39-cp39-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-39-aarch64-linux-gnu.so +0 -0
- pyogrio/_geometry.cpython-39-aarch64-linux-gnu.so +0 -0
- pyogrio/_io.cpython-39-aarch64-linux-gnu.so +0 -0
- pyogrio/_ogr.cpython-39-aarch64-linux-gnu.so +0 -0
- pyogrio/_version.py +3 -3
- pyogrio/_vsi.cpython-39-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
|
@@ -7,7 +7,7 @@ if(CMAKE_VERSION VERSION_LESS "2.8.12")
|
|
|
7
7
|
message(FATAL_ERROR "CMake >= 2.8.12 required")
|
|
8
8
|
endif()
|
|
9
9
|
cmake_policy(PUSH)
|
|
10
|
-
cmake_policy(VERSION 2.8.12...3.
|
|
10
|
+
cmake_policy(VERSION 2.8.12...3.28)
|
|
11
11
|
#----------------------------------------------------------------
|
|
12
12
|
# Generated CMake target import file.
|
|
13
13
|
#----------------------------------------------------------------
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$id": "https://proj.org/schemas/v0.7/projjson.schema.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"description": "Schema for PROJJSON (v0.7)",
|
|
5
|
-
"$comment": "This file exists both in data/ and in schemas/vXXX/. Keep both in sync. And if changing the value of $id, change PROJJSON_DEFAULT_VERSION accordingly in io.cpp",
|
|
5
|
+
"$comment": "This document is copyright Even Rouault and PROJ contributors, 2019-2023, and subject to the MIT license. This file exists both in data/ and in schemas/vXXX/. Keep both in sync. And if changing the value of $id, change PROJJSON_DEFAULT_VERSION accordingly in io.cpp",
|
|
6
6
|
|
|
7
7
|
"oneOf": [
|
|
8
8
|
{ "$ref": "#/definitions/crs" },
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
"spdxVersion": "SPDX-2.2",
|
|
4
4
|
"dataLicense": "CC0-1.0",
|
|
5
5
|
"SPDXID": "SPDXRef-DOCUMENT",
|
|
6
|
-
"documentNamespace": "https://spdx.org/spdxdocs/proj-arm64-linux-dynamic-release-9.4.
|
|
7
|
-
"name": "proj:arm64-linux-dynamic-release@9.4.
|
|
6
|
+
"documentNamespace": "https://spdx.org/spdxdocs/proj-arm64-linux-dynamic-release-9.4.1-fba5f38f-d4a2-4e46-8bba-3f6de9ca2c3a",
|
|
7
|
+
"name": "proj:arm64-linux-dynamic-release@9.4.1 b410f095d31bb162f9fa8ddd0c046646e92c848ed8fb3f7d76b01e1e8bfec8bc",
|
|
8
8
|
"creationInfo": {
|
|
9
9
|
"creators": [
|
|
10
|
-
"Tool: vcpkg-unknownhash"
|
|
10
|
+
"Tool: vcpkg-2999-12-31-unknownhash"
|
|
11
11
|
],
|
|
12
|
-
"created": "2024-
|
|
12
|
+
"created": "2024-09-27T18:53:50Z"
|
|
13
13
|
},
|
|
14
14
|
"relationships": [
|
|
15
15
|
{
|
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
{
|
|
88
88
|
"name": "proj",
|
|
89
89
|
"SPDXID": "SPDXRef-port",
|
|
90
|
-
"versionInfo": "9.4.
|
|
91
|
-
"downloadLocation": "git+https://github.com/Microsoft/vcpkg@
|
|
90
|
+
"versionInfo": "9.4.1",
|
|
91
|
+
"downloadLocation": "git+https://github.com/Microsoft/vcpkg@dafa38417689eb52c17a425ace8e1f3ecfb74045",
|
|
92
92
|
"homepage": "https://proj.org/",
|
|
93
93
|
"licenseConcluded": "MIT",
|
|
94
94
|
"licenseDeclared": "NOASSERTION",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
{
|
|
100
100
|
"name": "proj:arm64-linux-dynamic-release",
|
|
101
101
|
"SPDXID": "SPDXRef-binary",
|
|
102
|
-
"versionInfo": "
|
|
102
|
+
"versionInfo": "b410f095d31bb162f9fa8ddd0c046646e92c848ed8fb3f7d76b01e1e8bfec8bc",
|
|
103
103
|
"downloadLocation": "NONE",
|
|
104
104
|
"licenseConcluded": "MIT",
|
|
105
105
|
"licenseDeclared": "NOASSERTION",
|
|
@@ -109,86 +109,86 @@
|
|
|
109
109
|
{
|
|
110
110
|
"SPDXID": "SPDXRef-resource-1",
|
|
111
111
|
"name": "OSGeo/PROJ",
|
|
112
|
-
"downloadLocation": "git+https://github.com/OSGeo/PROJ@9.4.
|
|
112
|
+
"downloadLocation": "git+https://github.com/OSGeo/PROJ@9.4.1",
|
|
113
113
|
"licenseConcluded": "NOASSERTION",
|
|
114
114
|
"licenseDeclared": "NOASSERTION",
|
|
115
115
|
"copyrightText": "NOASSERTION",
|
|
116
116
|
"checksums": [
|
|
117
117
|
{
|
|
118
118
|
"algorithm": "SHA512",
|
|
119
|
-
"checksumValue": "
|
|
119
|
+
"checksumValue": "4b3ceb9e3b2213b0bb2fc839f4dd70e08ee53323465c7bb473131907e4b66c836623da115c7413dfd8bafd0a992fa173003063e2233ab577139ab8462655b6cc"
|
|
120
120
|
}
|
|
121
121
|
]
|
|
122
122
|
}
|
|
123
123
|
],
|
|
124
124
|
"files": [
|
|
125
125
|
{
|
|
126
|
-
"fileName": ".//opt/vcpkg/buildtrees/versioning_/versions/proj/
|
|
126
|
+
"fileName": ".//opt/vcpkg/buildtrees/versioning_/versions/proj/dafa38417689eb52c17a425ace8e1f3ecfb74045/usage",
|
|
127
127
|
"SPDXID": "SPDXRef-file-0",
|
|
128
128
|
"checksums": [
|
|
129
129
|
{
|
|
130
130
|
"algorithm": "SHA256",
|
|
131
|
-
"checksumValue": "
|
|
131
|
+
"checksumValue": "26169363c27e71a44cba9d703b22bbd13c191ab5e2d0612b3dd35c735c971fe6"
|
|
132
132
|
}
|
|
133
133
|
],
|
|
134
134
|
"licenseConcluded": "NOASSERTION",
|
|
135
135
|
"copyrightText": "NOASSERTION"
|
|
136
136
|
},
|
|
137
137
|
{
|
|
138
|
-
"fileName": ".//opt/vcpkg/buildtrees/versioning_/versions/proj/
|
|
138
|
+
"fileName": ".//opt/vcpkg/buildtrees/versioning_/versions/proj/dafa38417689eb52c17a425ace8e1f3ecfb74045/fix-proj4-targets-cmake.patch",
|
|
139
139
|
"SPDXID": "SPDXRef-file-1",
|
|
140
140
|
"checksums": [
|
|
141
141
|
{
|
|
142
142
|
"algorithm": "SHA256",
|
|
143
|
-
"checksumValue": "
|
|
143
|
+
"checksumValue": "d76e1d419d3367dda3381fd11a637f3465bc838d611fa8ceaca20048c1b3cd6e"
|
|
144
144
|
}
|
|
145
145
|
],
|
|
146
146
|
"licenseConcluded": "NOASSERTION",
|
|
147
147
|
"copyrightText": "NOASSERTION"
|
|
148
148
|
},
|
|
149
149
|
{
|
|
150
|
-
"fileName": ".//opt/vcpkg/buildtrees/versioning_/versions/proj/
|
|
150
|
+
"fileName": ".//opt/vcpkg/buildtrees/versioning_/versions/proj/dafa38417689eb52c17a425ace8e1f3ecfb74045/fix-win-output-name.patch",
|
|
151
151
|
"SPDXID": "SPDXRef-file-2",
|
|
152
152
|
"checksums": [
|
|
153
153
|
{
|
|
154
154
|
"algorithm": "SHA256",
|
|
155
|
-
"checksumValue": "
|
|
155
|
+
"checksumValue": "706e536cfe9a90c1b071ab5b00932fa96bb35c67fcb0f96c0fc4feb7c0b44011"
|
|
156
156
|
}
|
|
157
157
|
],
|
|
158
158
|
"licenseConcluded": "NOASSERTION",
|
|
159
159
|
"copyrightText": "NOASSERTION"
|
|
160
160
|
},
|
|
161
161
|
{
|
|
162
|
-
"fileName": ".//opt/vcpkg/buildtrees/versioning_/versions/proj/
|
|
162
|
+
"fileName": ".//opt/vcpkg/buildtrees/versioning_/versions/proj/dafa38417689eb52c17a425ace8e1f3ecfb74045/vcpkg.json",
|
|
163
163
|
"SPDXID": "SPDXRef-file-3",
|
|
164
164
|
"checksums": [
|
|
165
165
|
{
|
|
166
166
|
"algorithm": "SHA256",
|
|
167
|
-
"checksumValue": "
|
|
167
|
+
"checksumValue": "0dbf128c799775bc808b756ed9800d1fd349f7d41b874ad78a204d17988b8737"
|
|
168
168
|
}
|
|
169
169
|
],
|
|
170
170
|
"licenseConcluded": "NOASSERTION",
|
|
171
171
|
"copyrightText": "NOASSERTION"
|
|
172
172
|
},
|
|
173
173
|
{
|
|
174
|
-
"fileName": ".//opt/vcpkg/buildtrees/versioning_/versions/proj/
|
|
174
|
+
"fileName": ".//opt/vcpkg/buildtrees/versioning_/versions/proj/dafa38417689eb52c17a425ace8e1f3ecfb74045/remove_toolset_restriction.patch",
|
|
175
175
|
"SPDXID": "SPDXRef-file-4",
|
|
176
176
|
"checksums": [
|
|
177
177
|
{
|
|
178
178
|
"algorithm": "SHA256",
|
|
179
|
-
"checksumValue": "
|
|
179
|
+
"checksumValue": "25c1c986673bd539f5ec920684a08b38d0d37d9e24b6793e5b79dbd717bde04e"
|
|
180
180
|
}
|
|
181
181
|
],
|
|
182
182
|
"licenseConcluded": "NOASSERTION",
|
|
183
183
|
"copyrightText": "NOASSERTION"
|
|
184
184
|
},
|
|
185
185
|
{
|
|
186
|
-
"fileName": ".//opt/vcpkg/buildtrees/versioning_/versions/proj/
|
|
186
|
+
"fileName": ".//opt/vcpkg/buildtrees/versioning_/versions/proj/dafa38417689eb52c17a425ace8e1f3ecfb74045/portfile.cmake",
|
|
187
187
|
"SPDXID": "SPDXRef-file-5",
|
|
188
188
|
"checksums": [
|
|
189
189
|
{
|
|
190
190
|
"algorithm": "SHA256",
|
|
191
|
-
"checksumValue": "
|
|
191
|
+
"checksumValue": "c1e2909ff16c46a449fbb7e71e14ea3d33103491f21ce5191d899cafded1822f"
|
|
192
192
|
}
|
|
193
193
|
],
|
|
194
194
|
"licenseConcluded": "NOASSERTION",
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
cmake 0
|
|
2
|
-
curl
|
|
2
|
+
curl cb695a5d1939ee33bf9626ce32269b0bd325a12e65a585a8e8f220190aa403f1
|
|
3
3
|
features core;net;tiff
|
|
4
4
|
fix-proj4-targets-cmake.patch d76e1d419d3367dda3381fd11a637f3465bc838d611fa8ceaca20048c1b3cd6e
|
|
5
5
|
fix-win-output-name.patch 706e536cfe9a90c1b071ab5b00932fa96bb35c67fcb0f96c0fc4feb7c0b44011
|
|
6
|
-
nlohmann-json
|
|
7
|
-
portfile.cmake
|
|
8
|
-
ports.cmake
|
|
6
|
+
nlohmann-json 286a8ae48a6c0664d90e39c685703b5145fe035570cd7cb8708e7bb27a480c57
|
|
7
|
+
portfile.cmake c1e2909ff16c46a449fbb7e71e14ea3d33103491f21ce5191d899cafded1822f
|
|
8
|
+
ports.cmake 3581688c16865b2026d28240d7c6257b848475ffc9fe81b3f3d304973253cf5e
|
|
9
9
|
post_build_checks 2
|
|
10
10
|
remove_toolset_restriction.patch 25c1c986673bd539f5ec920684a08b38d0d37d9e24b6793e5b79dbd717bde04e
|
|
11
|
-
sqlite3
|
|
12
|
-
sqlite3
|
|
13
|
-
tiff
|
|
11
|
+
sqlite3 38ed2e302afc947869e2e6a9feadf92f4118676f6e9ff3b6813376d69ea02696
|
|
12
|
+
sqlite3 5cf4f782306be81d95dc5d743f1a09f6d3d6397f80864b78f9e22043fac84c44
|
|
13
|
+
tiff 1e5bca825c278accb4a2ec67a556f29e9e54e51ee0eca8f6cb9fa90c59841a99
|
|
14
14
|
triplet arm64-linux-dynamic-release
|
|
15
|
-
triplet_abi a2978ef94e01dd995e28fd3fc9d73a99d96cda95c172e0f1d199230f0e1bcdce-
|
|
15
|
+
triplet_abi a2978ef94e01dd995e28fd3fc9d73a99d96cda95c172e0f1d199230f0e1bcdce-8f20f723a25e9787363b95fcfd14b63d82b71ac3e295a73c97d09e681decb90c-beb576496a66e76502336c0e436ebdaabe8d0f8f
|
|
16
16
|
usage 26169363c27e71a44cba9d703b22bbd13c191ab5e2d0612b3dd35c735c971fe6
|
|
17
|
-
vcpkg-cmake
|
|
18
|
-
vcpkg-cmake-config
|
|
19
|
-
vcpkg.json
|
|
17
|
+
vcpkg-cmake 7cb9711415b0a62be2f6297fb548a28d18a5fe039a9101d49c2b6a6283540d2a
|
|
18
|
+
vcpkg-cmake-config 0df4e1080d226918b032f77e7ee0fa68f7b71a3584576e68015d5289b3e229d0
|
|
19
|
+
vcpkg.json 0dbf128c799775bc808b756ed9800d1fd349f7d41b874ad78a204d17988b8737
|
|
20
20
|
vcpkg_check_features 943b217e0968d64cf2cb9c272608e6a0b497377e792034f819809a79e1502c2b
|
|
21
21
|
vcpkg_copy_pdbs d57e4f196c82dc562a9968c6155073094513c31e2de475694143d3aa47954b1c
|
|
22
22
|
vcpkg_copy_tools 3d45ff761bddbabe8923b52330168dc3abd295fa469d3f2e47cb14dce85332d5
|
|
23
|
-
vcpkg_fixup_pkgconfig
|
|
23
|
+
vcpkg_fixup_pkgconfig 1a15f6c6d8e2b244d83a7514a0412d339127d2217d1df60ad1388b546c85f777
|
|
24
24
|
vcpkg_from_git 96ed81968f76354c00096dd8cd4e63c6a235fa969334a11ab18d11c0c512ff58
|
|
25
25
|
vcpkg_from_github b743742296a114ea1b18ae99672e02f142c4eb2bef7f57d36c038bedbfb0502f
|
|
26
26
|
vcpkg_list f5de3ebcbc40a4db90622ade9aca918e2cf404dc0d91342fcde457d730e6fa29
|
|
27
|
-
vcpkg_replace_string
|
|
27
|
+
vcpkg_replace_string b450deb79207478b37119743e00808ebc42de0628e7b98c14ab24728bd5c78b8
|
pyogrio/raw.py
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"""Low level functions to read and write OGR data sources."""
|
|
2
|
+
|
|
2
3
|
import warnings
|
|
4
|
+
from io import BytesIO
|
|
5
|
+
from pathlib import Path
|
|
3
6
|
|
|
4
|
-
from pyogrio._env import GDALEnv
|
|
5
7
|
from pyogrio._compat import HAS_ARROW_API, HAS_ARROW_WRITE_API, HAS_PYARROW
|
|
8
|
+
from pyogrio._env import GDALEnv
|
|
6
9
|
from pyogrio.core import detect_write_driver
|
|
7
10
|
from pyogrio.errors import DataSourceError
|
|
8
11
|
from pyogrio.util import (
|
|
@@ -18,8 +21,8 @@ with GDALEnv():
|
|
|
18
21
|
_get_driver_metadata_item,
|
|
19
22
|
get_gdal_version,
|
|
20
23
|
get_gdal_version_string,
|
|
21
|
-
ogr_driver_supports_write,
|
|
22
24
|
ogr_driver_supports_vsi,
|
|
25
|
+
ogr_driver_supports_write,
|
|
23
26
|
)
|
|
24
27
|
|
|
25
28
|
|
|
@@ -61,7 +64,7 @@ def read(
|
|
|
61
64
|
Parameters
|
|
62
65
|
----------
|
|
63
66
|
path_or_buffer : pathlib.Path or str, or bytes buffer
|
|
64
|
-
A dataset path or URI, or
|
|
67
|
+
A dataset path or URI, raw buffer, or file-like object with a read method.
|
|
65
68
|
layer : int or str, optional (default: first layer)
|
|
66
69
|
If an integer is provided, it corresponds to the index of the layer
|
|
67
70
|
with the data source. If a string is provided, it must match the name
|
|
@@ -190,7 +193,6 @@ def read(
|
|
|
190
193
|
https://www.gaia-gis.it/gaia-sins/spatialite-sql-latest.html
|
|
191
194
|
|
|
192
195
|
"""
|
|
193
|
-
|
|
194
196
|
dataset_kwargs = _preprocess_options_key_value(kwargs) if kwargs else {}
|
|
195
197
|
|
|
196
198
|
return ogr_read(
|
|
@@ -233,8 +235,7 @@ def read_arrow(
|
|
|
233
235
|
return_fids=False,
|
|
234
236
|
**kwargs,
|
|
235
237
|
):
|
|
236
|
-
"""
|
|
237
|
-
Read OGR data source into a pyarrow Table.
|
|
238
|
+
"""Read OGR data source into a pyarrow Table.
|
|
238
239
|
|
|
239
240
|
See docstring of `read` for parameters.
|
|
240
241
|
|
|
@@ -252,6 +253,7 @@ def read_arrow(
|
|
|
252
253
|
"geometry_type": "<geometry_type>",
|
|
253
254
|
"geometry_name": "<name of geometry column in arrow table>",
|
|
254
255
|
}
|
|
256
|
+
|
|
255
257
|
"""
|
|
256
258
|
if not HAS_PYARROW:
|
|
257
259
|
raise RuntimeError(
|
|
@@ -358,8 +360,7 @@ def open_arrow(
|
|
|
358
360
|
use_pyarrow=False,
|
|
359
361
|
**kwargs,
|
|
360
362
|
):
|
|
361
|
-
"""
|
|
362
|
-
Open OGR data source as a stream of Arrow record batches.
|
|
363
|
+
"""Open OGR data source as a stream of Arrow record batches.
|
|
363
364
|
|
|
364
365
|
See docstring of `read` for parameters.
|
|
365
366
|
|
|
@@ -388,7 +389,6 @@ def open_arrow(
|
|
|
388
389
|
|
|
389
390
|
Examples
|
|
390
391
|
--------
|
|
391
|
-
|
|
392
392
|
>>> from pyogrio.raw import open_arrow
|
|
393
393
|
>>> import pyarrow as pa
|
|
394
394
|
>>> import shapely
|
|
@@ -397,8 +397,9 @@ def open_arrow(
|
|
|
397
397
|
>>> meta, stream = source
|
|
398
398
|
>>> # wrap the arrow stream object in a pyarrow RecordBatchReader
|
|
399
399
|
>>> reader = pa.RecordBatchReader.from_stream(stream)
|
|
400
|
+
>>> geom_col = meta["geometry_name"] or "wkb_geometry"
|
|
400
401
|
>>> for batch in reader:
|
|
401
|
-
>>> geometries = shapely.from_wkb(batch[
|
|
402
|
+
>>> geometries = shapely.from_wkb(batch[geom_col])
|
|
402
403
|
|
|
403
404
|
The returned `stream` object needs to be consumed by a library implementing
|
|
404
405
|
the Arrow PyCapsule Protocol. In the above example, pyarrow is used through
|
|
@@ -407,8 +408,9 @@ def open_arrow(
|
|
|
407
408
|
|
|
408
409
|
>>> with open_arrow(path, use_pyarrow=True) as source:
|
|
409
410
|
>>> meta, reader = source
|
|
411
|
+
>>> geom_col = meta["geometry_name"] or "wkb_geometry"
|
|
410
412
|
>>> for batch in reader:
|
|
411
|
-
>>> geometries = shapely.from_wkb(batch[
|
|
413
|
+
>>> geometries = shapely.from_wkb(batch[geom_col])
|
|
412
414
|
|
|
413
415
|
Returns
|
|
414
416
|
-------
|
|
@@ -425,6 +427,7 @@ def open_arrow(
|
|
|
425
427
|
"geometry_type": "<geometry_type>",
|
|
426
428
|
"geometry_name": "<name of geometry column in arrow table>",
|
|
427
429
|
}
|
|
430
|
+
|
|
428
431
|
"""
|
|
429
432
|
if not HAS_ARROW_API:
|
|
430
433
|
raise RuntimeError("GDAL>= 3.6 required to read using arrow")
|
|
@@ -454,7 +457,7 @@ def open_arrow(
|
|
|
454
457
|
|
|
455
458
|
|
|
456
459
|
def _parse_options_names(xml):
|
|
457
|
-
"""Convert metadata xml to list of names"""
|
|
460
|
+
"""Convert metadata xml to list of names."""
|
|
458
461
|
# Based on Fiona's meta.py
|
|
459
462
|
# (https://github.com/Toblerity/Fiona/blob/91c13ad8424641557a4e5f038f255f9b657b1bc5/fiona/meta.py)
|
|
460
463
|
import xml.etree.ElementTree as ET
|
|
@@ -471,29 +474,27 @@ def _parse_options_names(xml):
|
|
|
471
474
|
|
|
472
475
|
|
|
473
476
|
def _validate_metadata(dataset_metadata, layer_metadata, metadata):
|
|
474
|
-
""" """
|
|
477
|
+
"""Validate the metadata."""
|
|
475
478
|
if metadata is not None:
|
|
476
479
|
if layer_metadata is not None:
|
|
477
480
|
raise ValueError("Cannot pass both metadata and layer_metadata")
|
|
478
481
|
layer_metadata = metadata
|
|
479
482
|
|
|
480
483
|
# validate metadata types
|
|
481
|
-
for
|
|
482
|
-
if
|
|
483
|
-
for k, v in
|
|
484
|
+
for meta in [dataset_metadata, layer_metadata]:
|
|
485
|
+
if meta is not None:
|
|
486
|
+
for k, v in meta.items():
|
|
484
487
|
if not isinstance(k, str):
|
|
485
488
|
raise ValueError(f"metadata key {k} must be a string")
|
|
486
489
|
|
|
487
490
|
if not isinstance(v, str):
|
|
488
491
|
raise ValueError(f"metadata value {v} must be a string")
|
|
492
|
+
|
|
489
493
|
return dataset_metadata, layer_metadata
|
|
490
494
|
|
|
491
495
|
|
|
492
496
|
def _preprocess_options_kwargs(driver, dataset_options, layer_options, kwargs):
|
|
493
|
-
"""
|
|
494
|
-
Preprocess kwargs and split in dataset and layer creation options.
|
|
495
|
-
"""
|
|
496
|
-
|
|
497
|
+
"""Preprocess kwargs and split in dataset and layer creation options."""
|
|
497
498
|
dataset_kwargs = _preprocess_options_key_value(dataset_options or {})
|
|
498
499
|
layer_kwargs = _preprocess_options_key_value(layer_options or {})
|
|
499
500
|
if kwargs:
|
|
@@ -516,13 +517,14 @@ def _preprocess_options_kwargs(driver, dataset_options, layer_options, kwargs):
|
|
|
516
517
|
|
|
517
518
|
|
|
518
519
|
def _get_write_path_driver(path, driver, append=False):
|
|
519
|
-
"""Validate and return path and driver
|
|
520
|
+
"""Validate and return path and driver.
|
|
520
521
|
|
|
521
522
|
Parameters
|
|
522
523
|
----------
|
|
523
524
|
path : str or io.BytesIO
|
|
524
525
|
path to output file on writeable file system or an io.BytesIO object to
|
|
525
|
-
allow writing to memory
|
|
526
|
+
allow writing to memory. Will raise NotImplementedError if an open file
|
|
527
|
+
handle is passed.
|
|
526
528
|
driver : str, optional (default: None)
|
|
527
529
|
The OGR format driver used to write the vector file. By default attempts
|
|
528
530
|
to infer driver from path. Must be provided to write to a file-like
|
|
@@ -533,8 +535,8 @@ def _get_write_path_driver(path, driver, append=False):
|
|
|
533
535
|
Returns
|
|
534
536
|
-------
|
|
535
537
|
(path, driver)
|
|
536
|
-
"""
|
|
537
538
|
|
|
539
|
+
"""
|
|
538
540
|
if isinstance(path, BytesIO):
|
|
539
541
|
if driver is None:
|
|
540
542
|
raise ValueError("driver must be provided to write to in-memory file")
|
|
@@ -554,8 +556,14 @@ def _get_write_path_driver(path, driver, append=False):
|
|
|
554
556
|
if append:
|
|
555
557
|
raise NotImplementedError("append is not supported for in-memory files")
|
|
556
558
|
|
|
559
|
+
elif hasattr(path, "write") and not isinstance(path, Path):
|
|
560
|
+
raise NotImplementedError(
|
|
561
|
+
"writing to an open file handle is not yet supported; instead, write to a "
|
|
562
|
+
"BytesIO instance and then read bytes from that to write to the file handle"
|
|
563
|
+
)
|
|
564
|
+
|
|
557
565
|
else:
|
|
558
|
-
path = vsi_path(
|
|
566
|
+
path = vsi_path(path)
|
|
559
567
|
|
|
560
568
|
if driver is None:
|
|
561
569
|
driver = detect_write_driver(path)
|
|
@@ -605,7 +613,8 @@ def write(
|
|
|
605
613
|
----------
|
|
606
614
|
path : str or io.BytesIO
|
|
607
615
|
path to output file on writeable file system or an io.BytesIO object to
|
|
608
|
-
allow writing to memory
|
|
616
|
+
allow writing to memory. Will raise NotImplementedError if an open file
|
|
617
|
+
handle is passed; use BytesIO instead.
|
|
609
618
|
NOTE: support for writing to memory is limited to specific drivers.
|
|
610
619
|
geometry : ndarray of WKB encoded geometries or None
|
|
611
620
|
If None, geometries will not be written to output file
|
|
@@ -677,6 +686,10 @@ def write(
|
|
|
677
686
|
a key-value dictionary.
|
|
678
687
|
gdal_tz_offsets : dict, optional (default: None)
|
|
679
688
|
Used to handle GDAL timezone offsets for each field contained in dict.
|
|
689
|
+
**kwargs
|
|
690
|
+
Additional driver-specific dataset creation options passed to OGR. Invalid
|
|
691
|
+
options will trigger a warning.
|
|
692
|
+
|
|
680
693
|
"""
|
|
681
694
|
# if dtypes is given, remove it from kwargs (dtypes is included in meta returned by
|
|
682
695
|
# read, and it is convenient to pass meta directly into write for round trip tests)
|
|
@@ -698,7 +711,8 @@ def write(
|
|
|
698
711
|
warnings.warn(
|
|
699
712
|
"'crs' was not provided. The output dataset will not have "
|
|
700
713
|
"projection information defined and may not be usable in other "
|
|
701
|
-
"systems."
|
|
714
|
+
"systems.",
|
|
715
|
+
stacklevel=2,
|
|
702
716
|
)
|
|
703
717
|
|
|
704
718
|
# preprocess kwargs and split in dataset and layer creation options
|
|
@@ -745,8 +759,7 @@ def write_arrow(
|
|
|
745
759
|
layer_options=None,
|
|
746
760
|
**kwargs,
|
|
747
761
|
):
|
|
748
|
-
"""
|
|
749
|
-
Write an Arrow-compatible data source to an OGR file format.
|
|
762
|
+
"""Write an Arrow-compatible data source to an OGR file format.
|
|
750
763
|
|
|
751
764
|
.. _Arrow PyCapsule Protocol: https://arrow.apache.org/docs/format/CDataInterface/PyCapsuleInterface.html
|
|
752
765
|
|
|
@@ -782,6 +795,8 @@ def write_arrow(
|
|
|
782
795
|
type of the output file to this value. Use this parameter with caution because
|
|
783
796
|
using a wrong layer geometry type may result in errors when writing the
|
|
784
797
|
file, may be ignored by the driver, or may result in invalid files.
|
|
798
|
+
crs : str, optional (default: None)
|
|
799
|
+
WKT-encoded CRS of the geometries to be written.
|
|
785
800
|
encoding : str, optional (default: None)
|
|
786
801
|
Only used for the .dbf file of ESRI Shapefiles. If not specified,
|
|
787
802
|
uses the default locale.
|
|
@@ -842,7 +857,8 @@ def write_arrow(
|
|
|
842
857
|
warnings.warn(
|
|
843
858
|
"'crs' was not provided. The output dataset will not have "
|
|
844
859
|
"projection information defined and may not be usable in other "
|
|
845
|
-
"systems."
|
|
860
|
+
"systems.",
|
|
861
|
+
stacklevel=2,
|
|
846
862
|
)
|
|
847
863
|
|
|
848
864
|
dataset_metadata, layer_metadata = _validate_metadata(
|