pyogrio 0.7.2__cp38-cp38-manylinux_2_28_aarch64.whl → 0.9.0__cp38-cp38-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 (48) hide show
  1. pyogrio/__init__.py +4 -0
  2. pyogrio/_compat.py +6 -1
  3. pyogrio/_err.cpython-38-aarch64-linux-gnu.so +0 -0
  4. pyogrio/_err.pyx +7 -3
  5. pyogrio/_geometry.cpython-38-aarch64-linux-gnu.so +0 -0
  6. pyogrio/_io.cpython-38-aarch64-linux-gnu.so +0 -0
  7. pyogrio/_io.pyx +904 -242
  8. pyogrio/_ogr.cpython-38-aarch64-linux-gnu.so +0 -0
  9. pyogrio/_ogr.pxd +69 -13
  10. pyogrio/_ogr.pyx +8 -24
  11. pyogrio/_version.py +3 -3
  12. pyogrio/_vsi.cpython-38-aarch64-linux-gnu.so +0 -0
  13. pyogrio/_vsi.pxd +4 -0
  14. pyogrio/_vsi.pyx +140 -0
  15. pyogrio/core.py +43 -44
  16. pyogrio/gdal_data/GDAL-targets-release.cmake +3 -3
  17. pyogrio/gdal_data/GDAL-targets.cmake +10 -6
  18. pyogrio/gdal_data/GDALConfigVersion.cmake +3 -3
  19. pyogrio/gdal_data/gdalinfo_output.schema.json +2 -0
  20. pyogrio/gdal_data/gdalvrt.xsd +163 -0
  21. pyogrio/gdal_data/ogrinfo_output.schema.json +12 -1
  22. pyogrio/gdal_data/vcpkg.spdx.json +26 -26
  23. pyogrio/gdal_data/vcpkg_abi_info.txt +27 -26
  24. pyogrio/geopandas.py +140 -34
  25. pyogrio/proj_data/ITRF2008 +2 -2
  26. pyogrio/proj_data/proj-config-version.cmake +2 -2
  27. pyogrio/proj_data/proj-config.cmake +2 -1
  28. pyogrio/proj_data/proj-targets.cmake +13 -13
  29. pyogrio/proj_data/proj.db +0 -0
  30. pyogrio/proj_data/proj4-targets.cmake +13 -13
  31. pyogrio/proj_data/vcpkg.spdx.json +20 -42
  32. pyogrio/proj_data/vcpkg_abi_info.txt +14 -15
  33. pyogrio/raw.py +438 -116
  34. pyogrio/tests/conftest.py +75 -6
  35. pyogrio/tests/fixtures/poly_not_enough_points.shp.zip +0 -0
  36. pyogrio/tests/test_arrow.py +841 -7
  37. pyogrio/tests/test_core.py +99 -7
  38. pyogrio/tests/test_geopandas_io.py +827 -121
  39. pyogrio/tests/test_path.py +23 -3
  40. pyogrio/tests/test_raw_io.py +276 -50
  41. pyogrio/util.py +39 -19
  42. {pyogrio-0.7.2.dist-info → pyogrio-0.9.0.dist-info}/METADATA +2 -2
  43. {pyogrio-0.7.2.dist-info → pyogrio-0.9.0.dist-info}/RECORD +210 -207
  44. {pyogrio-0.7.2.dist-info → pyogrio-0.9.0.dist-info}/WHEEL +1 -1
  45. pyogrio.libs/{libgdal-cb554135.so.33.3.7.2 → libgdal-6ff0914e.so.34.3.8.5} +0 -0
  46. pyogrio/tests/win32.py +0 -86
  47. {pyogrio-0.7.2.dist-info → pyogrio-0.9.0.dist-info}/LICENSE +0 -0
  48. {pyogrio-0.7.2.dist-info → pyogrio-0.9.0.dist-info}/top_level.txt +0 -0
@@ -14,6 +14,7 @@ from pyogrio import (
14
14
  get_gdal_data_path,
15
15
  )
16
16
  from pyogrio.core import detect_write_driver
17
+ from pyogrio._compat import GDAL_GE_38
17
18
  from pyogrio.errors import DataSourceError, DataLayerError
18
19
  from pyogrio.tests.conftest import HAS_SHAPELY, prepare_testfile
19
20
 
@@ -176,6 +177,20 @@ def test_list_layers(naturalearth_lowres, naturalearth_lowres_vsi, test_fgdb_vsi
176
177
  assert array_equal(fgdb_layers[6], ["test_areas", "MultiPolygon Z"])
177
178
 
178
179
 
180
+ def test_list_layers_bytes(geojson_bytes):
181
+ layers = list_layers(geojson_bytes)
182
+
183
+ assert layers.shape == (1, 2)
184
+ assert layers[0, 0] == "test"
185
+
186
+
187
+ def test_list_layers_filelike(geojson_filelike):
188
+ layers = list_layers(geojson_filelike)
189
+
190
+ assert layers.shape == (1, 2)
191
+ assert layers[0, 0] == "test"
192
+
193
+
179
194
  def test_read_bounds(naturalearth_lowres):
180
195
  fids, bounds = read_bounds(naturalearth_lowres)
181
196
  assert fids.shape == (177,)
@@ -186,11 +201,41 @@ def test_read_bounds(naturalearth_lowres):
186
201
  assert allclose(bounds[:, 0], [-180.0, -18.28799, 180.0, -16.02088])
187
202
 
188
203
 
204
+ def test_read_bounds_vsi(naturalearth_lowres_vsi):
205
+ fids, bounds = read_bounds(naturalearth_lowres_vsi[1])
206
+ assert fids.shape == (177,)
207
+ assert bounds.shape == (4, 177)
208
+
209
+ assert fids[0] == 0
210
+ # Fiji; wraps antimeridian
211
+ assert allclose(bounds[:, 0], [-180.0, -18.28799, 180.0, -16.02088])
212
+
213
+
214
+ def test_read_bounds_bytes(geojson_bytes):
215
+ fids, bounds = read_bounds(geojson_bytes)
216
+ assert fids.shape == (3,)
217
+ assert bounds.shape == (4, 3)
218
+ assert allclose(bounds[:, 0], [-180.0, -18.28799, 180.0, -16.02088])
219
+
220
+
221
+ def test_read_bounds_filelike(geojson_filelike):
222
+ fids, bounds = read_bounds(geojson_filelike)
223
+ assert fids.shape == (3,)
224
+ assert bounds.shape == (4, 3)
225
+ assert allclose(bounds[:, 0], [-180.0, -18.28799, 180.0, -16.02088])
226
+
227
+
189
228
  def test_read_bounds_max_features(naturalearth_lowres):
190
229
  bounds = read_bounds(naturalearth_lowres, max_features=2)[1]
191
230
  assert bounds.shape == (4, 2)
192
231
 
193
232
 
233
+ def test_read_bounds_unspecified_layer_warning(data_dir):
234
+ """Reading a multi-layer file without specifying a layer gives a warning."""
235
+ with pytest.warns(UserWarning, match="More than one layer found "):
236
+ read_bounds(data_dir / "sample.osm.pbf")
237
+
238
+
194
239
  def test_read_bounds_negative_max_features(naturalearth_lowres):
195
240
  with pytest.raises(ValueError, match="'max_features' must be >= 0"):
196
241
  read_bounds(naturalearth_lowres, max_features=-1)
@@ -354,23 +399,62 @@ def test_read_bounds_bbox_intersects_vs_envelope_overlaps(naturalearth_lowres_al
354
399
  assert array_equal(fids, [4, 27]) # USA, MEX
355
400
 
356
401
 
402
+ @pytest.mark.parametrize("naturalearth_lowres", [".shp", ".gpkg"], indirect=True)
357
403
  def test_read_info(naturalearth_lowres):
358
404
  meta = read_info(naturalearth_lowres)
359
405
 
406
+ assert meta["layer_name"] == "naturalearth_lowres"
360
407
  assert meta["crs"] == "EPSG:4326"
361
- assert meta["geometry_type"] == "Polygon"
362
408
  assert meta["encoding"] == "UTF-8"
363
409
  assert meta["fields"].shape == (5,)
364
410
  assert meta["dtypes"].tolist() == ["int64", "object", "object", "object", "float64"]
365
411
  assert meta["features"] == 177
366
412
  assert allclose(meta["total_bounds"], (-180, -90, 180, 83.64513))
367
- assert meta["driver"] == "ESRI Shapefile"
368
413
  assert meta["capabilities"]["random_read"] is True
369
- assert meta["capabilities"]["fast_set_next_by_index"] is True
370
414
  assert meta["capabilities"]["fast_spatial_filter"] is False
371
415
  assert meta["capabilities"]["fast_feature_count"] is True
372
416
  assert meta["capabilities"]["fast_total_bounds"] is True
373
417
 
418
+ if naturalearth_lowres.suffix == ".gpkg":
419
+ assert meta["fid_column"] == "fid"
420
+ assert meta["geometry_name"] == "geom"
421
+ assert meta["geometry_type"] == "MultiPolygon"
422
+ assert meta["driver"] == "GPKG"
423
+ if GDAL_GE_38:
424
+ # this capability is only True for GPKG if GDAL >= 3.8
425
+ assert meta["capabilities"]["fast_set_next_by_index"] is True
426
+ elif naturalearth_lowres.suffix == ".shp":
427
+ # fid_column == "" for formats where fid is not physically stored
428
+ assert meta["fid_column"] == ""
429
+ # geometry_name == "" for formats where geometry column name cannot be customized
430
+ assert meta["geometry_name"] == ""
431
+ assert meta["geometry_type"] == "Polygon"
432
+ assert meta["driver"] == "ESRI Shapefile"
433
+ assert meta["capabilities"]["fast_set_next_by_index"] is True
434
+ else:
435
+ raise ValueError(f"test not implemented for ext {naturalearth_lowres.suffix}")
436
+
437
+
438
+ def test_read_info_vsi(naturalearth_lowres_vsi):
439
+ meta = read_info(naturalearth_lowres_vsi[1])
440
+
441
+ assert meta["fields"].shape == (5,)
442
+ assert meta["features"] == 177
443
+
444
+
445
+ def test_read_info_bytes(geojson_bytes):
446
+ meta = read_info(geojson_bytes)
447
+
448
+ assert meta["fields"].shape == (5,)
449
+ assert meta["features"] == 3
450
+
451
+
452
+ def test_read_info_filelike(geojson_filelike):
453
+ meta = read_info(geojson_filelike)
454
+
455
+ assert meta["fields"].shape == (5,)
456
+ assert meta["features"] == 3
457
+
374
458
 
375
459
  @pytest.mark.parametrize(
376
460
  "dataset_kwargs,fields",
@@ -440,10 +524,12 @@ def test_read_info_force_feature_count(data_dir, layer, force, expected):
440
524
  [(True, (-180.0, -90.0, 180.0, 83.64513)), (False, None)],
441
525
  )
442
526
  def test_read_info_force_total_bounds(
443
- tmpdir, naturalearth_lowres, force_total_bounds, expected_total_bounds
527
+ tmp_path, naturalearth_lowres, force_total_bounds, expected_total_bounds
444
528
  ):
445
- # Geojson files don't hava a fast way to determine total_bounds
446
- geojson_path = prepare_testfile(naturalearth_lowres, dst_dir=tmpdir, ext=".geojson")
529
+ geojson_path = prepare_testfile(
530
+ naturalearth_lowres, dst_dir=tmp_path, ext=".geojsonl"
531
+ )
532
+
447
533
  info = read_info(geojson_path, force_total_bounds=force_total_bounds)
448
534
  if expected_total_bounds is not None:
449
535
  assert allclose(info["total_bounds"], expected_total_bounds)
@@ -451,8 +537,14 @@ def test_read_info_force_total_bounds(
451
537
  assert info["total_bounds"] is None
452
538
 
453
539
 
540
+ def test_read_info_unspecified_layer_warning(data_dir):
541
+ """Reading a multi-layer file without specifying a layer gives a warning."""
542
+ with pytest.warns(UserWarning, match="More than one layer found "):
543
+ read_info(data_dir / "sample.osm.pbf")
544
+
545
+
454
546
  def test_read_info_without_geometry(test_fgdb_vsi):
455
- assert read_info(test_fgdb_vsi)["total_bounds"] is None
547
+ assert read_info(test_fgdb_vsi, layer="basetable_2")["total_bounds"] is None
456
548
 
457
549
 
458
550
  @pytest.mark.parametrize(