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.

Files changed (73) hide show
  1. pyogrio/__init__.py +20 -13
  2. pyogrio/_compat.py +7 -1
  3. pyogrio/_env.py +4 -6
  4. pyogrio/_err.cpython-312-aarch64-linux-gnu.so +0 -0
  5. pyogrio/_geometry.cpython-312-aarch64-linux-gnu.so +0 -0
  6. pyogrio/_io.cpython-312-aarch64-linux-gnu.so +0 -0
  7. pyogrio/_ogr.cpython-312-aarch64-linux-gnu.so +0 -0
  8. pyogrio/_version.py +3 -3
  9. pyogrio/_vsi.cpython-312-aarch64-linux-gnu.so +0 -0
  10. pyogrio/core.py +86 -20
  11. pyogrio/errors.py +9 -16
  12. pyogrio/gdal_data/GDAL-targets-release.cmake +3 -3
  13. pyogrio/gdal_data/GDAL-targets.cmake +1 -1
  14. pyogrio/gdal_data/GDALConfig.cmake +0 -1
  15. pyogrio/gdal_data/GDALConfigVersion.cmake +3 -3
  16. pyogrio/gdal_data/MM_m_idofic.csv +321 -0
  17. pyogrio/gdal_data/gdaltileindex.xsd +269 -0
  18. pyogrio/gdal_data/gdalvrt.xsd +130 -22
  19. pyogrio/gdal_data/ogrinfo_output.schema.json +23 -0
  20. pyogrio/gdal_data/ogrvrt.xsd +3 -0
  21. pyogrio/gdal_data/pci_datum.txt +222 -155
  22. pyogrio/gdal_data/pci_ellips.txt +90 -38
  23. pyogrio/gdal_data/vcpkg.spdx.json +27 -27
  24. pyogrio/gdal_data/vcpkg_abi_info.txt +25 -25
  25. pyogrio/geopandas.py +44 -27
  26. pyogrio/proj_data/proj-config-version.cmake +2 -2
  27. pyogrio/proj_data/proj-targets.cmake +1 -1
  28. pyogrio/proj_data/proj.db +0 -0
  29. pyogrio/proj_data/proj4-targets.cmake +1 -1
  30. pyogrio/proj_data/projjson.schema.json +1 -1
  31. pyogrio/proj_data/vcpkg.spdx.json +21 -21
  32. pyogrio/proj_data/vcpkg_abi_info.txt +13 -13
  33. pyogrio/raw.py +46 -30
  34. pyogrio/tests/conftest.py +206 -12
  35. pyogrio/tests/fixtures/README.md +32 -13
  36. pyogrio/tests/fixtures/curve.gpkg +0 -0
  37. pyogrio/tests/fixtures/{test_multisurface.gpkg → curvepolygon.gpkg} +0 -0
  38. pyogrio/tests/fixtures/line_zm.gpkg +0 -0
  39. pyogrio/tests/fixtures/multisurface.gpkg +0 -0
  40. pyogrio/tests/test_arrow.py +178 -24
  41. pyogrio/tests/test_core.py +162 -72
  42. pyogrio/tests/test_geopandas_io.py +341 -96
  43. pyogrio/tests/test_path.py +30 -17
  44. pyogrio/tests/test_raw_io.py +165 -54
  45. pyogrio/tests/test_util.py +56 -0
  46. pyogrio/util.py +55 -31
  47. {pyogrio-0.8.0.dist-info → pyogrio-0.10.0.dist-info}/LICENSE +1 -1
  48. {pyogrio-0.8.0.dist-info → pyogrio-0.10.0.dist-info}/METADATA +37 -8
  49. {pyogrio-0.8.0.dist-info → pyogrio-0.10.0.dist-info}/RECORD +203 -218
  50. {pyogrio-0.8.0.dist-info → pyogrio-0.10.0.dist-info}/WHEEL +1 -1
  51. pyogrio.libs/{libgdal-b2fb2022.so.34.3.8.5 → libgdal-b0847c7b.so.35.3.9.1} +0 -0
  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 -2738
  58. pyogrio/_ogr.pxd +0 -441
  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/test_datetime.geojson +0 -7
  69. pyogrio/tests/fixtures/test_datetime_tz.geojson +0 -8
  70. pyogrio/tests/fixtures/test_fgdb.gdb.zip +0 -0
  71. pyogrio/tests/fixtures/test_nested.geojson +0 -18
  72. pyogrio/tests/fixtures/test_ogr_types_list.geojson +0 -12
  73. {pyogrio-0.8.0.dist-info → pyogrio-0.10.0.dist-info}/top_level.txt +0 -0
pyogrio/__init__.py CHANGED
@@ -1,28 +1,32 @@
1
+ """Vectorized vector I/O using OGR."""
2
+
1
3
  try:
2
4
  # we try importing shapely, to ensure it is imported (and it can load its
3
5
  # own GEOS copy) before we load GDAL and its linked GEOS
4
- import shapely # noqa
5
- import shapely.geos # noqa
6
+ import shapely
7
+ import shapely.geos # noqa: F401
6
8
  except Exception:
7
9
  pass
8
10
 
11
+ from pyogrio._version import get_versions
9
12
  from pyogrio.core import (
10
- list_drivers,
13
+ __gdal_geos_version__,
14
+ __gdal_version__,
15
+ __gdal_version_string__,
11
16
  detect_write_driver,
17
+ get_gdal_config_option,
18
+ get_gdal_data_path,
19
+ list_drivers,
12
20
  list_layers,
13
21
  read_bounds,
14
22
  read_info,
15
23
  set_gdal_config_options,
16
- get_gdal_config_option,
17
- get_gdal_data_path,
18
- __gdal_version__,
19
- __gdal_version_string__,
20
- __gdal_geos_version__,
24
+ vsi_listtree,
25
+ vsi_rmtree,
26
+ vsi_unlink,
21
27
  )
22
- from pyogrio.raw import read_arrow, open_arrow, write_arrow
23
28
  from pyogrio.geopandas import read_dataframe, write_dataframe
24
- from pyogrio._version import get_versions
25
-
29
+ from pyogrio.raw import open_arrow, read_arrow, write_arrow
26
30
 
27
31
  __version__ = get_versions()["version"]
28
32
  del get_versions
@@ -36,10 +40,13 @@ __all__ = [
36
40
  "set_gdal_config_options",
37
41
  "get_gdal_config_option",
38
42
  "get_gdal_data_path",
39
- "read_arrow",
40
43
  "open_arrow",
41
- "write_arrow",
44
+ "read_arrow",
42
45
  "read_dataframe",
46
+ "vsi_listtree",
47
+ "vsi_rmtree",
48
+ "vsi_unlink",
49
+ "write_arrow",
43
50
  "write_dataframe",
44
51
  "__gdal_version__",
45
52
  "__gdal_version_string__",
pyogrio/_compat.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from packaging.version import Version
2
2
 
3
- from pyogrio.core import __gdal_version__, __gdal_geos_version__
3
+ from pyogrio.core import __gdal_geos_version__, __gdal_version__
4
4
 
5
5
  # detect optional dependencies
6
6
  try:
@@ -8,6 +8,11 @@ try:
8
8
  except ImportError:
9
9
  pyarrow = None
10
10
 
11
+ try:
12
+ import pyproj
13
+ except ImportError:
14
+ pyproj = None
15
+
11
16
  try:
12
17
  import shapely
13
18
  except ImportError:
@@ -27,6 +32,7 @@ except ImportError:
27
32
  HAS_ARROW_API = __gdal_version__ >= (3, 6, 0)
28
33
  HAS_ARROW_WRITE_API = __gdal_version__ >= (3, 8, 0)
29
34
  HAS_PYARROW = pyarrow is not None
35
+ HAS_PYPROJ = pyproj is not None
30
36
 
31
37
  HAS_GEOPANDAS = geopandas is not None
32
38
 
pyogrio/_env.py CHANGED
@@ -4,13 +4,11 @@
4
4
  # adapted from Fiona: https://github.com/Toblerity/Fiona/pull/875
5
5
 
6
6
 
7
- from contextlib import contextmanager
8
7
  import logging
9
8
  import os
10
- from pathlib import Path
11
9
  import platform
12
- import sys
13
-
10
+ from contextlib import contextmanager
11
+ from pathlib import Path
14
12
 
15
13
  log = logging.getLogger(__name__)
16
14
  log.addHandler(logging.NullHandler())
@@ -29,10 +27,10 @@ except ImportError:
29
27
 
30
28
  gdal_dll_dir = None
31
29
 
32
- if platform.system() == "Windows" and sys.version_info >= (3, 8):
30
+ if platform.system() == "Windows":
33
31
  # if loading of extension modules fails, search for gdal dll directory
34
32
  try:
35
- import pyogrio._io # NOQA
33
+ import pyogrio._io # noqa: F401
36
34
 
37
35
  except ImportError:
38
36
  for path in os.getenv("PATH", "").split(os.pathsep):
pyogrio/_version.py CHANGED
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2024-05-06T14:34:51-0700",
11
+ "date": "2024-09-28T11:22:57-0700",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "46c35a7e98d85923cfefe73dae7285404e72d9a6",
15
- "version": "0.8.0"
14
+ "full-revisionid": "eb8e7889224155ffa0f779360db29f07f370eef1",
15
+ "version": "0.10.0"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
pyogrio/core.py CHANGED
@@ -1,27 +1,36 @@
1
+ """Core functions to interact with OGR data sources."""
2
+
3
+ from pathlib import Path
4
+ from typing import Optional, Union
5
+
1
6
  from pyogrio._env import GDALEnv
2
7
  from pyogrio.util import (
3
- get_vsi_path_or_buffer,
4
- _preprocess_options_key_value,
5
8
  _mask_to_wkb,
9
+ _preprocess_options_key_value,
10
+ get_vsi_path_or_buffer,
6
11
  )
7
12
 
8
-
9
13
  with GDALEnv():
14
+ from pyogrio._err import _register_error_handler
15
+ from pyogrio._io import ogr_list_layers, ogr_read_bounds, ogr_read_info
10
16
  from pyogrio._ogr import (
11
- get_gdal_version,
12
- get_gdal_version_string,
13
- get_gdal_geos_version,
14
- ogr_list_drivers,
15
- set_gdal_config_options as _set_gdal_config_options,
17
+ _get_drivers_for_path,
18
+ _register_drivers,
16
19
  get_gdal_config_option as _get_gdal_config_option,
17
20
  get_gdal_data_path as _get_gdal_data_path,
21
+ get_gdal_geos_version,
22
+ get_gdal_version,
23
+ get_gdal_version_string,
18
24
  init_gdal_data as _init_gdal_data,
19
25
  init_proj_data as _init_proj_data,
20
- _register_drivers,
21
- _get_drivers_for_path,
26
+ ogr_list_drivers,
27
+ set_gdal_config_options as _set_gdal_config_options,
28
+ )
29
+ from pyogrio._vsi import (
30
+ ogr_vsi_listtree,
31
+ ogr_vsi_rmtree,
32
+ ogr_vsi_unlink,
22
33
  )
23
- from pyogrio._err import _register_error_handler
24
- from pyogrio._io import ogr_list_layers, ogr_read_bounds, ogr_read_info
25
34
 
26
35
  _init_gdal_data()
27
36
  _init_proj_data()
@@ -48,8 +57,8 @@ def list_drivers(read=False, write=False):
48
57
  dict
49
58
  Mapping of driver name to file mode capabilities: ``"r"``: read, ``"w"``: write.
50
59
  Drivers that are available but with unknown support are marked with ``"?"``
51
- """
52
60
 
61
+ """
53
62
  drivers = ogr_list_drivers()
54
63
 
55
64
  if read:
@@ -62,8 +71,9 @@ def list_drivers(read=False, write=False):
62
71
 
63
72
 
64
73
  def detect_write_driver(path):
65
- """Attempt to infer the driver for a path by extension or prefix. Only
66
- drivers that support write capabilities will be detected.
74
+ """Attempt to infer the driver for a path by extension or prefix.
75
+
76
+ Only drivers that support write capabilities will be detected.
67
77
 
68
78
  If the path cannot be resolved to a single driver, a ValueError will be
69
79
  raised.
@@ -71,11 +81,13 @@ def detect_write_driver(path):
71
81
  Parameters
72
82
  ----------
73
83
  path : str
84
+ data source path
74
85
 
75
86
  Returns
76
87
  -------
77
88
  str
78
89
  name of the driver, if detected
90
+
79
91
  """
80
92
  # try to infer driver from path
81
93
  drivers = _get_drivers_for_path(path)
@@ -106,14 +118,15 @@ def list_layers(path_or_buffer, /):
106
118
  Parameters
107
119
  ----------
108
120
  path_or_buffer : str, pathlib.Path, bytes, or file-like
121
+ A dataset path or URI, raw buffer, or file-like object with a read method.
109
122
 
110
123
  Returns
111
124
  -------
112
125
  ndarray shape (2, n)
113
126
  array of pairs of [<layer name>, <layer geometry type>]
114
127
  Note: geometry is `None` for nonspatial layers.
115
- """
116
128
 
129
+ """
117
130
  return ogr_list_layers(get_vsi_path_or_buffer(path_or_buffer))
118
131
 
119
132
 
@@ -136,6 +149,7 @@ def read_bounds(
136
149
  Parameters
137
150
  ----------
138
151
  path_or_buffer : str, pathlib.Path, bytes, or file-like
152
+ A dataset path or URI, raw buffer, or file-like object with a read method.
139
153
  layer : int or str, optional (default: first layer)
140
154
  If an integer is provided, it corresponds to the index of the layer
141
155
  with the data source. If a string is provided, it must match the name
@@ -172,8 +186,8 @@ def read_bounds(
172
186
  fids are global IDs read from the FID field of the dataset
173
187
  bounds are ndarray of shape(4, n) containing ``xmin``, ``ymin``, ``xmax``,
174
188
  ``ymax``
175
- """
176
189
 
190
+ """
177
191
  return ogr_read_bounds(
178
192
  get_vsi_path_or_buffer(path_or_buffer),
179
193
  layer=layer,
@@ -222,6 +236,7 @@ def read_info(
222
236
  Parameters
223
237
  ----------
224
238
  path_or_buffer : str, pathlib.Path, bytes, or file-like
239
+ A dataset path or URI, raw buffer, or file-like object with a read method.
225
240
  layer : [type], optional
226
241
  Name or index of layer in data source. Reads the first layer by default.
227
242
  encoding : [type], optional (default: None)
@@ -257,8 +272,8 @@ def read_info(
257
272
  "dataset_metadata": "<dict of dataset metadata or None>"
258
273
  "layer_metadata": "<dict of layer metadata or None>"
259
274
  }
260
- """
261
275
 
276
+ """
262
277
  dataset_kwargs = _preprocess_options_key_value(kwargs) if kwargs else {}
263
278
 
264
279
  return ogr_read_info(
@@ -288,8 +303,8 @@ def set_gdal_config_options(options):
288
303
  configuration options. ``True`` / ``False`` are normalized to ``'ON'``
289
304
  / ``'OFF'``. A value of ``None`` for a config option can be used to clear out a
290
305
  previously set value.
291
- """
292
306
 
307
+ """
293
308
  _set_gdal_config_options(options)
294
309
 
295
310
 
@@ -305,8 +320,8 @@ def get_gdal_config_option(name):
305
320
  -------
306
321
  value of the option or None if not set
307
322
  ``'ON'`` / ``'OFF'`` are normalized to ``True`` / ``False``.
308
- """
309
323
 
324
+ """
310
325
  return _get_gdal_config_option(name)
311
326
 
312
327
 
@@ -316,5 +331,56 @@ def get_gdal_data_path():
316
331
  Returns
317
332
  -------
318
333
  str, or None if data directory was not found
334
+
319
335
  """
320
336
  return _get_gdal_data_path()
337
+
338
+
339
+ def vsi_listtree(path: Union[str, Path], pattern: Optional[str] = None):
340
+ """Recursively list the contents of a VSI directory.
341
+
342
+ An fnmatch pattern can be specified to filter the directories/files
343
+ returned.
344
+
345
+ Parameters
346
+ ----------
347
+ path : str or pathlib.Path
348
+ Path to the VSI directory to be listed.
349
+ pattern : str, optional
350
+ Pattern to filter results, in fnmatch format.
351
+
352
+ """
353
+ if isinstance(path, Path):
354
+ path = path.as_posix()
355
+
356
+ return ogr_vsi_listtree(path, pattern=pattern)
357
+
358
+
359
+ def vsi_rmtree(path: Union[str, Path]):
360
+ """Recursively remove VSI directory.
361
+
362
+ Parameters
363
+ ----------
364
+ path : str or pathlib.Path
365
+ path to the VSI directory to be removed.
366
+
367
+ """
368
+ if isinstance(path, Path):
369
+ path = path.as_posix()
370
+
371
+ ogr_vsi_rmtree(path)
372
+
373
+
374
+ def vsi_unlink(path: Union[str, Path]):
375
+ """Remove a VSI file.
376
+
377
+ Parameters
378
+ ----------
379
+ path : str or pathlib.Path
380
+ path to vsimem file to be removed
381
+
382
+ """
383
+ if isinstance(path, Path):
384
+ path = path.as_posix()
385
+
386
+ ogr_vsi_unlink(path)
pyogrio/errors.py CHANGED
@@ -1,32 +1,25 @@
1
- class DataSourceError(RuntimeError):
2
- """Errors relating to opening or closing an OGRDataSource (with >= 1 layers)"""
1
+ """Custom errors."""
2
+
3
3
 
4
- pass
4
+ class DataSourceError(RuntimeError):
5
+ """Errors relating to opening or closing an OGRDataSource (with >= 1 layers)."""
5
6
 
6
7
 
7
8
  class DataLayerError(RuntimeError):
8
- """Errors relating to working with a single OGRLayer"""
9
-
10
- pass
9
+ """Errors relating to working with a single OGRLayer."""
11
10
 
12
11
 
13
12
  class CRSError(DataLayerError):
14
- """Errors relating to getting or setting CRS values"""
15
-
16
- pass
13
+ """Errors relating to getting or setting CRS values."""
17
14
 
18
15
 
19
16
  class FeatureError(DataLayerError):
20
- """Errors related to reading or writing a feature"""
21
-
22
- pass
17
+ """Errors related to reading or writing a feature."""
23
18
 
24
19
 
25
20
  class GeometryError(DataLayerError):
26
- """Errors relating to getting or setting a geometry field"""
27
-
28
- pass
21
+ """Errors relating to getting or setting a geometry field."""
29
22
 
30
23
 
31
24
  class FieldError(DataLayerError):
32
- """Errors relating to getting or setting a non-geometry field"""
25
+ """Errors relating to getting or setting a non-geometry field."""
@@ -8,12 +8,12 @@ set(CMAKE_IMPORT_FILE_VERSION 1)
8
8
  # Import target "GDAL::GDAL" for configuration "Release"
9
9
  set_property(TARGET GDAL::GDAL APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
10
10
  set_target_properties(GDAL::GDAL PROPERTIES
11
- IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libgdal.so.34.3.8.5"
12
- IMPORTED_SONAME_RELEASE "libgdal.so.34"
11
+ IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libgdal.so.35.3.9.1"
12
+ IMPORTED_SONAME_RELEASE "libgdal.so.35"
13
13
  )
14
14
 
15
15
  list(APPEND _cmake_import_check_targets GDAL::GDAL )
16
- list(APPEND _cmake_import_check_files_for_GDAL::GDAL "${_IMPORT_PREFIX}/lib/libgdal.so.34.3.8.5" )
16
+ list(APPEND _cmake_import_check_files_for_GDAL::GDAL "${_IMPORT_PREFIX}/lib/libgdal.so.35.3.9.1" )
17
17
 
18
18
  # Commands beyond this point should not need to know the version.
19
19
  set(CMAKE_IMPORT_FILE_VERSION)
@@ -7,7 +7,7 @@ if(CMAKE_VERSION VERSION_LESS "2.8.3")
7
7
  message(FATAL_ERROR "CMake >= 2.8.3 required")
8
8
  endif()
9
9
  cmake_policy(PUSH)
10
- cmake_policy(VERSION 2.8.3...3.27)
10
+ cmake_policy(VERSION 2.8.3...3.28)
11
11
  #----------------------------------------------------------------
12
12
  # Generated CMake target import file.
13
13
  #----------------------------------------------------------------
@@ -14,7 +14,6 @@ list(APPEND CMAKE_PROGRAM_PATH "${vcpkg_host_prefix}/tools/pkgconf")
14
14
  include("${CMAKE_CURRENT_LIST_DIR}/DefineFindPackage2.cmake")
15
15
  include("${CMAKE_CURRENT_LIST_DIR}/GdalFindModulePath.cmake")
16
16
  find_dependency(Threads)
17
- find_dependency(PROJ 9 CONFIG)
18
17
 
19
18
  if(DEFINED _gdal_module_path_backup)
20
19
  set(CMAKE_MODULE_PATH "${_gdal_module_path_backup}")
@@ -10,13 +10,13 @@
10
10
  # The variable CVF_VERSION must be set before calling configure_file().
11
11
 
12
12
 
13
- set(PACKAGE_VERSION "3.8.5")
13
+ set(PACKAGE_VERSION "3.9.1")
14
14
 
15
15
  if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
16
16
  set(PACKAGE_VERSION_COMPATIBLE FALSE)
17
17
  else()
18
18
 
19
- if("3.8.5" MATCHES "^([0-9]+)\\.([0-9]+)")
19
+ if("3.9.1" MATCHES "^([0-9]+)\\.([0-9]+)")
20
20
  set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
21
21
  set(CVF_VERSION_MINOR "${CMAKE_MATCH_2}")
22
22
 
@@ -27,7 +27,7 @@ else()
27
27
  string(REGEX REPLACE "^0+" "" CVF_VERSION_MINOR "${CVF_VERSION_MINOR}")
28
28
  endif()
29
29
  else()
30
- set(CVF_VERSION_MAJOR "3.8.5")
30
+ set(CVF_VERSION_MAJOR "3.9.1")
31
31
  set(CVF_VERSION_MINOR "")
32
32
  endif()
33
33