pyogrio 0.9.0__cp312-cp312-win_amd64.whl → 0.11.0__cp312-cp312-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.
- pyogrio/__init__.py +35 -28
- pyogrio/_compat.py +15 -1
- pyogrio/_env.py +4 -6
- pyogrio/_err.c +8941 -3106
- pyogrio/_err.cp312-win_amd64.pyd +0 -0
- pyogrio/_geometry.c +1008 -807
- pyogrio/_geometry.cp312-win_amd64.pyd +0 -0
- pyogrio/_io.c +10678 -9440
- pyogrio/_io.cp312-win_amd64.pyd +0 -0
- pyogrio/_ogr.c +1950 -1873
- pyogrio/_ogr.cp312-win_amd64.pyd +0 -0
- pyogrio/_version.py +3 -3
- pyogrio/_vsi.c +7558 -2509
- pyogrio/_vsi.cp312-win_amd64.pyd +0 -0
- pyogrio/core.py +86 -20
- pyogrio/errors.py +9 -16
- pyogrio/gdal_data/GDAL-targets.cmake +2 -2
- 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/gdalinfo_output.schema.json +3 -3
- pyogrio/gdal_data/gdaltileindex.xsd +253 -0
- pyogrio/gdal_data/gdalvrt.xsd +178 -63
- pyogrio/gdal_data/nitf_spec.xml +1 -17
- pyogrio/gdal_data/nitf_spec.xsd +1 -17
- pyogrio/gdal_data/ogrinfo_output.schema.json +23 -0
- pyogrio/gdal_data/ogrvrt.xsd +4 -17
- pyogrio/gdal_data/osmconf.ini +3 -1
- pyogrio/gdal_data/pci_datum.txt +222 -155
- pyogrio/gdal_data/pci_ellips.txt +90 -38
- pyogrio/gdal_data/pdfcomposition.xsd +1 -17
- pyogrio/gdal_data/vcpkg.spdx.json +29 -24
- pyogrio/gdal_data/vcpkg_abi_info.txt +32 -31
- pyogrio/gdal_data/vdv452.xml +1 -17
- pyogrio/gdal_data/vdv452.xsd +1 -17
- pyogrio/geopandas.py +122 -66
- pyogrio/proj_data/ITRF2014 +1 -1
- pyogrio/proj_data/ITRF2020 +91 -0
- pyogrio/proj_data/proj-config-version.cmake +2 -2
- pyogrio/proj_data/proj-config.cmake +1 -1
- pyogrio/proj_data/proj-targets-release.cmake +3 -2
- pyogrio/proj_data/proj-targets.cmake +2 -2
- pyogrio/proj_data/proj.db +0 -0
- pyogrio/proj_data/proj.ini +11 -3
- pyogrio/proj_data/proj4-targets-release.cmake +3 -2
- pyogrio/proj_data/proj4-targets.cmake +2 -2
- pyogrio/proj_data/projjson.schema.json +1 -1
- pyogrio/proj_data/usage +7 -2
- pyogrio/proj_data/vcpkg.spdx.json +26 -21
- pyogrio/proj_data/vcpkg_abi_info.txt +19 -18
- pyogrio/raw.py +46 -30
- pyogrio/tests/conftest.py +214 -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 +181 -24
- pyogrio/tests/test_core.py +170 -76
- pyogrio/tests/test_geopandas_io.py +483 -135
- pyogrio/tests/test_path.py +39 -17
- pyogrio/tests/test_raw_io.py +170 -55
- pyogrio/tests/test_util.py +56 -0
- pyogrio/util.py +69 -32
- pyogrio-0.11.0.dist-info/DELVEWHEEL +2 -0
- pyogrio-0.11.0.dist-info/METADATA +124 -0
- {pyogrio-0.9.0.dist-info → pyogrio-0.11.0.dist-info}/RECORD +90 -102
- {pyogrio-0.9.0.dist-info → pyogrio-0.11.0.dist-info}/WHEEL +1 -1
- {pyogrio-0.9.0.dist-info → pyogrio-0.11.0.dist-info/licenses}/LICENSE +1 -1
- pyogrio.libs/{Lerc-5e4d8cbeeabca06f95e2270792304dc3.dll → Lerc-0a4c85fb364eca6153da109568898e6c.dll} +0 -0
- pyogrio.libs/{gdal-b434963605a006e01c486c0df6dea4e0.dll → gdal-34e3e080255b205ef706390e097fa4dc.dll} +0 -0
- pyogrio.libs/geos-d8f20037634583c2efcd6ea1f4153169.dll +0 -0
- pyogrio.libs/geos_c-046e8885887192fced9516bda554471d.dll +0 -0
- pyogrio.libs/geotiff-1f2f76a5d30685a8e0497d9dbf8a79cf.dll +0 -0
- pyogrio.libs/{iconv-2-8fcc23ddc6f096c45871011b6e008b44.dll → iconv-2-4b71ebbdf6834234e0c64cb2439b77cf.dll} +0 -0
- pyogrio.libs/{jpeg62-2f9b7af22d78338e8f0be0058503dc35.dll → jpeg62-bf2a75b1f2695748cd86238ddb19c65b.dll} +0 -0
- pyogrio.libs/json-c-4bc6781090e73c9b22d8dc057618a277.dll +0 -0
- pyogrio.libs/libcrypto-3-x64-c8f1692ed45cf55faecce2c448056b2e.dll +0 -0
- pyogrio.libs/libcurl-f3604410cd467a44d927794ebdce81b8.dll +0 -0
- pyogrio.libs/libexpat-385074fd54deb4b640baafa42cbb3146.dll +0 -0
- pyogrio.libs/liblzma-8968f0bfd463b7fe612b20d07adc3c1e.dll +0 -0
- pyogrio.libs/libpng16-44105208fe941d03e9f0c17bdbb952f7.dll +0 -0
- pyogrio.libs/libssl-3-x64-58c364315f431ab1f0e48b311b8cf105.dll +0 -0
- pyogrio.libs/msvcp140-99aa35e2033bb8d388bc35c8a68b77e3.dll +0 -0
- pyogrio.libs/proj_9-ee59474f99643c112eb02aa34a910237.dll +0 -0
- pyogrio.libs/{qhull_r-c45abde5d0c92faf723cc2942138af77.dll → qhull_r-eaac2f11a3d8241f082e54447c7504d7.dll} +0 -0
- pyogrio.libs/sqlite3-dc748e3452944fd41001abacdd783569.dll +0 -0
- pyogrio.libs/tiff-c409ddbe87b39639b83fee50d4aea318.dll +0 -0
- pyogrio.libs/{zlib1-e1272810861a13dd8d6cff3beac47f17.dll → zlib1-094085b7b78666197dcc8e1fce2d835d.dll} +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 -2742
- pyogrio/_ogr.pxd +0 -444
- 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/tests/fixtures/poly_not_enough_points.shp.zip +0 -0
- 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.9.0.dist-info/DELVEWHEEL +0 -2
- pyogrio-0.9.0.dist-info/METADATA +0 -100
- pyogrio.libs/geos-f0622d0794b81c937a851b2e6fa9b712.dll +0 -0
- pyogrio.libs/geos_c-0e16bf70612fc3301d077b9d863a3fdb.dll +0 -0
- pyogrio.libs/geotiff-772e7c705fb15ddf91b432adb4eb1f6c.dll +0 -0
- pyogrio.libs/json-c-e52a077545e4057de42beb4948289b41.dll +0 -0
- pyogrio.libs/libcurl-bc81cd8afe15b10c0821b181b6af8bd0.dll +0 -0
- pyogrio.libs/libexpat-fbe03ca8917dfda776562d4338b289b8.dll +0 -0
- pyogrio.libs/liblzma-6b36f24d54d3dd45f274a2aebef81085.dll +0 -0
- pyogrio.libs/libpng16-13928571ad910705eae8d7dd8eef8b11.dll +0 -0
- pyogrio.libs/msvcp140-46db46e967c8db2cb7a20fc75872a57e.dll +0 -0
- pyogrio.libs/proj-8a30239ef2dfc3b9dd2bb48e8abb330f.dll +0 -0
- pyogrio.libs/sqlite3-df30c3cf230727e23c43c40126a530f7.dll +0 -0
- pyogrio.libs/tiff-43630f30487a9015213475ae86ed3fa3.dll +0 -0
- {pyogrio-0.9.0.dist-info → pyogrio-0.11.0.dist-info}/top_level.txt +0 -0
|
@@ -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-x64-windows-dynamic-release-9.
|
|
7
|
-
"name": "proj:x64-windows-dynamic-release@9.
|
|
6
|
+
"documentNamespace": "https://spdx.org/spdxdocs/proj-x64-windows-dynamic-release-9.6.0-0559eca9-1f3d-480e-a8dd-f2116495b329",
|
|
7
|
+
"name": "proj:x64-windows-dynamic-release@9.6.0 1bd513a77c4e5f6d9018d5699a29f9d0ae06d9622957bcacdb70c0d429bd7588",
|
|
8
8
|
"creationInfo": {
|
|
9
9
|
"creators": [
|
|
10
|
-
"Tool: vcpkg-
|
|
10
|
+
"Tool: vcpkg-2025-04-16-f9b6c6917b23c1ccf16c1a9f015ebabf8f615045"
|
|
11
11
|
],
|
|
12
|
-
"created": "
|
|
12
|
+
"created": "2025-05-07T14:26:56Z"
|
|
13
13
|
},
|
|
14
14
|
"relationships": [
|
|
15
15
|
{
|
|
@@ -81,14 +81,19 @@
|
|
|
81
81
|
"spdxElementId": "SPDXRef-file-5",
|
|
82
82
|
"relationshipType": "CONTAINED_BY",
|
|
83
83
|
"relatedSpdxElement": "SPDXRef-port"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"spdxElementId": "SPDXRef-file-5",
|
|
87
|
+
"relationshipType": "DEPENDENCY_MANIFEST_OF",
|
|
88
|
+
"relatedSpdxElement": "SPDXRef-port"
|
|
84
89
|
}
|
|
85
90
|
],
|
|
86
91
|
"packages": [
|
|
87
92
|
{
|
|
88
93
|
"name": "proj",
|
|
89
94
|
"SPDXID": "SPDXRef-port",
|
|
90
|
-
"versionInfo": "9.
|
|
91
|
-
"downloadLocation": "git+https://github.com/Microsoft/vcpkg@
|
|
95
|
+
"versionInfo": "9.6.0",
|
|
96
|
+
"downloadLocation": "git+https://github.com/Microsoft/vcpkg@157177ebd5778822eaf744dd5c725e553758a866",
|
|
92
97
|
"homepage": "https://proj.org/",
|
|
93
98
|
"licenseConcluded": "MIT",
|
|
94
99
|
"licenseDeclared": "NOASSERTION",
|
|
@@ -99,7 +104,7 @@
|
|
|
99
104
|
{
|
|
100
105
|
"name": "proj:x64-windows-dynamic-release",
|
|
101
106
|
"SPDXID": "SPDXRef-binary",
|
|
102
|
-
"versionInfo": "
|
|
107
|
+
"versionInfo": "1bd513a77c4e5f6d9018d5699a29f9d0ae06d9622957bcacdb70c0d429bd7588",
|
|
103
108
|
"downloadLocation": "NONE",
|
|
104
109
|
"licenseConcluded": "MIT",
|
|
105
110
|
"licenseDeclared": "NOASSERTION",
|
|
@@ -107,23 +112,23 @@
|
|
|
107
112
|
"comment": "This is a binary package built by vcpkg."
|
|
108
113
|
},
|
|
109
114
|
{
|
|
110
|
-
"SPDXID": "SPDXRef-resource-
|
|
115
|
+
"SPDXID": "SPDXRef-resource-0",
|
|
111
116
|
"name": "OSGeo/PROJ",
|
|
112
|
-
"downloadLocation": "git+https://github.com/OSGeo/PROJ@9.
|
|
117
|
+
"downloadLocation": "git+https://github.com/OSGeo/PROJ@9.6.0",
|
|
113
118
|
"licenseConcluded": "NOASSERTION",
|
|
114
119
|
"licenseDeclared": "NOASSERTION",
|
|
115
120
|
"copyrightText": "NOASSERTION",
|
|
116
121
|
"checksums": [
|
|
117
122
|
{
|
|
118
123
|
"algorithm": "SHA512",
|
|
119
|
-
"checksumValue": "
|
|
124
|
+
"checksumValue": "45d8bfb883431c62c2627cecf583a4374efda7f109c2b43d3fe8ef18136f30cf57682d6e6c44256ba099533754392c87f71e940a41018a577f540310001e0f05"
|
|
120
125
|
}
|
|
121
126
|
]
|
|
122
127
|
}
|
|
123
128
|
],
|
|
124
129
|
"files": [
|
|
125
130
|
{
|
|
126
|
-
"fileName": "./
|
|
131
|
+
"fileName": "./fix-proj4-targets-cmake.patch",
|
|
127
132
|
"SPDXID": "SPDXRef-file-0",
|
|
128
133
|
"checksums": [
|
|
129
134
|
{
|
|
@@ -135,60 +140,60 @@
|
|
|
135
140
|
"copyrightText": "NOASSERTION"
|
|
136
141
|
},
|
|
137
142
|
{
|
|
138
|
-
"fileName": "./
|
|
143
|
+
"fileName": "./portfile.cmake",
|
|
139
144
|
"SPDXID": "SPDXRef-file-1",
|
|
140
145
|
"checksums": [
|
|
141
146
|
{
|
|
142
147
|
"algorithm": "SHA256",
|
|
143
|
-
"checksumValue": "
|
|
148
|
+
"checksumValue": "5fd54e02ca8ceda95178cb097182d81c5e10590cb15f74c1f67ed328eab84af2"
|
|
144
149
|
}
|
|
145
150
|
],
|
|
146
151
|
"licenseConcluded": "NOASSERTION",
|
|
147
152
|
"copyrightText": "NOASSERTION"
|
|
148
153
|
},
|
|
149
154
|
{
|
|
150
|
-
"fileName": "./
|
|
155
|
+
"fileName": "./remove_toolset_restriction.patch",
|
|
151
156
|
"SPDXID": "SPDXRef-file-2",
|
|
152
157
|
"checksums": [
|
|
153
158
|
{
|
|
154
159
|
"algorithm": "SHA256",
|
|
155
|
-
"checksumValue": "
|
|
160
|
+
"checksumValue": "25c1c986673bd539f5ec920684a08b38d0d37d9e24b6793e5b79dbd717bde04e"
|
|
156
161
|
}
|
|
157
162
|
],
|
|
158
163
|
"licenseConcluded": "NOASSERTION",
|
|
159
164
|
"copyrightText": "NOASSERTION"
|
|
160
165
|
},
|
|
161
166
|
{
|
|
162
|
-
"fileName": "./
|
|
167
|
+
"fileName": "./sqlite.diff",
|
|
163
168
|
"SPDXID": "SPDXRef-file-3",
|
|
164
169
|
"checksums": [
|
|
165
170
|
{
|
|
166
171
|
"algorithm": "SHA256",
|
|
167
|
-
"checksumValue": "
|
|
172
|
+
"checksumValue": "75049bf707593bb9a22a6f77ccc062fe1343484a12920adc7be5c29c14746857"
|
|
168
173
|
}
|
|
169
174
|
],
|
|
170
175
|
"licenseConcluded": "NOASSERTION",
|
|
171
176
|
"copyrightText": "NOASSERTION"
|
|
172
177
|
},
|
|
173
178
|
{
|
|
174
|
-
"fileName": "./
|
|
179
|
+
"fileName": "./usage",
|
|
175
180
|
"SPDXID": "SPDXRef-file-4",
|
|
176
181
|
"checksums": [
|
|
177
182
|
{
|
|
178
183
|
"algorithm": "SHA256",
|
|
179
|
-
"checksumValue": "
|
|
184
|
+
"checksumValue": "ae06beae83376cd9f11db8c2596bd038f89ae1e2cd32b82ee333f1572070370a"
|
|
180
185
|
}
|
|
181
186
|
],
|
|
182
187
|
"licenseConcluded": "NOASSERTION",
|
|
183
188
|
"copyrightText": "NOASSERTION"
|
|
184
189
|
},
|
|
185
190
|
{
|
|
186
|
-
"fileName": "./
|
|
191
|
+
"fileName": "./vcpkg.json",
|
|
187
192
|
"SPDXID": "SPDXRef-file-5",
|
|
188
193
|
"checksums": [
|
|
189
194
|
{
|
|
190
195
|
"algorithm": "SHA256",
|
|
191
|
-
"checksumValue": "
|
|
196
|
+
"checksumValue": "88ecc073bf74d5a0a114bb1357499f6210c84a4f5a8b7beed2af94907f2f8802"
|
|
192
197
|
}
|
|
193
198
|
],
|
|
194
199
|
"licenseConcluded": "NOASSERTION",
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
cmake 3.
|
|
2
|
-
curl
|
|
1
|
+
cmake 3.31.6
|
|
2
|
+
curl 414c6605db2fd050acfd3cf9683cc404e0027aedb48e3b0d672e9af3c648576d
|
|
3
3
|
features core;net;tiff
|
|
4
4
|
fix-proj4-targets-cmake.patch d76e1d419d3367dda3381fd11a637f3465bc838d611fa8ceaca20048c1b3cd6e
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
ports.cmake 0500e9e2422fe0084c99bdd0c9de4c7069b76da14c8b58228a7e95ebac43058a
|
|
5
|
+
nlohmann-json 09804dd558ba2fad556ab1b33bc2451caee1001cd07afca97b1e623a435eb8b6
|
|
6
|
+
portfile.cmake 5fd54e02ca8ceda95178cb097182d81c5e10590cb15f74c1f67ed328eab84af2
|
|
7
|
+
ports.cmake a9f8f745f9f4d225039f9810e79670f10f38c7455222865616ce430a06f75d1f
|
|
9
8
|
post_build_checks 2
|
|
10
|
-
powershell 7.4.
|
|
9
|
+
powershell 7.4.7
|
|
11
10
|
remove_toolset_restriction.patch 25c1c986673bd539f5ec920684a08b38d0d37d9e24b6793e5b79dbd717bde04e
|
|
12
|
-
|
|
13
|
-
sqlite3
|
|
14
|
-
|
|
11
|
+
sqlite.diff 75049bf707593bb9a22a6f77ccc062fe1343484a12920adc7be5c29c14746857
|
|
12
|
+
sqlite3 2fa31d8aeeb0c1552e37b15d5f8d362065dbdd367efdf64af9a0b3c00a0fb444
|
|
13
|
+
sqlite3 b992eccfd5d5ff912cd477f12ba8c9714274f7eebdaebd8ed3504b18fca11fdc
|
|
14
|
+
tiff ce474888d3b5fc229f86ca3c824741f0f71f544a4a77b52afa153fc3b9e96c84
|
|
15
15
|
triplet x64-windows-dynamic-release
|
|
16
|
-
triplet_abi 36210185afbd528d6d7303808480ab7d54f062730bbef9fc1603f69b72ca549a-
|
|
17
|
-
usage
|
|
18
|
-
vcpkg-cmake
|
|
19
|
-
vcpkg-cmake-config
|
|
20
|
-
vcpkg.json
|
|
16
|
+
triplet_abi 36210185afbd528d6d7303808480ab7d54f062730bbef9fc1603f69b72ca549a-1d3d767ab10b488977977b83f6c2da7e06afd80b1e375a2a41c60c343e7b3f94-34423399a946c3fbabc27fbe8378a3d18985fb1b
|
|
17
|
+
usage ae06beae83376cd9f11db8c2596bd038f89ae1e2cd32b82ee333f1572070370a
|
|
18
|
+
vcpkg-cmake 639c486849b7c8da4db56c9a3e77c964856c4e041d7393cde30ebfbc891e9025
|
|
19
|
+
vcpkg-cmake-config 48fe94b10186578956ce5bdf2ce8a24e588c55aa49bb1711d35eaf74c06a9c77
|
|
20
|
+
vcpkg.json 88ecc073bf74d5a0a114bb1357499f6210c84a4f5a8b7beed2af94907f2f8802
|
|
21
21
|
vcpkg_check_features 943b217e0968d64cf2cb9c272608e6a0b497377e792034f819809a79e1502c2b
|
|
22
|
-
vcpkg_copy_pdbs
|
|
22
|
+
vcpkg_copy_pdbs d15c2f2822d93ecb9023af44803328e491c5374136e0813600289582a72d196d
|
|
23
23
|
vcpkg_copy_tools 3d45ff761bddbabe8923b52330168dc3abd295fa469d3f2e47cb14dce85332d5
|
|
24
|
-
vcpkg_fixup_pkgconfig
|
|
24
|
+
vcpkg_fixup_pkgconfig 1a15f6c6d8e2b244d83a7514a0412d339127d2217d1df60ad1388b546c85f777
|
|
25
25
|
vcpkg_from_git 96ed81968f76354c00096dd8cd4e63c6a235fa969334a11ab18d11c0c512ff58
|
|
26
26
|
vcpkg_from_github b743742296a114ea1b18ae99672e02f142c4eb2bef7f57d36c038bedbfb0502f
|
|
27
|
+
vcpkg_install_copyright ba6c169ab4e59fa05682e530cdeb883767de22c8391f023d4e6844a7ec5dd3d2
|
|
27
28
|
vcpkg_list f5de3ebcbc40a4db90622ade9aca918e2cf404dc0d91342fcde457d730e6fa29
|
|
28
|
-
vcpkg_replace_string
|
|
29
|
+
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(
|