pyogrio 0.9.0__tar.gz → 0.11.0__tar.gz

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 (66) hide show
  1. {pyogrio-0.9.0 → pyogrio-0.11.0}/LICENSE +1 -1
  2. pyogrio-0.11.0/PKG-INFO +124 -0
  3. pyogrio-0.11.0/README.md +70 -0
  4. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/__init__.py +28 -21
  5. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/_compat.py +15 -1
  6. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/_env.py +4 -6
  7. pyogrio-0.11.0/pyogrio/_err.pxd +9 -0
  8. pyogrio-0.11.0/pyogrio/_err.pyx +441 -0
  9. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/_geometry.pxd +1 -1
  10. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/_geometry.pyx +48 -48
  11. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/_io.pyx +478 -286
  12. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/_ogr.pxd +139 -69
  13. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/_ogr.pyx +58 -37
  14. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/_version.py +3 -3
  15. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/_vsi.pxd +2 -2
  16. pyogrio-0.11.0/pyogrio/_vsi.pyx +288 -0
  17. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/core.py +86 -20
  18. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/errors.py +9 -16
  19. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/geopandas.py +122 -66
  20. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/raw.py +46 -30
  21. pyogrio-0.11.0/pyogrio/tests/conftest.py +406 -0
  22. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/tests/fixtures/README.md +32 -13
  23. pyogrio-0.11.0/pyogrio/tests/fixtures/curve.gpkg +0 -0
  24. pyogrio-0.9.0/pyogrio/tests/fixtures/test_multisurface.gpkg → pyogrio-0.11.0/pyogrio/tests/fixtures/curvepolygon.gpkg +0 -0
  25. pyogrio-0.11.0/pyogrio/tests/fixtures/line_zm.gpkg +0 -0
  26. pyogrio-0.11.0/pyogrio/tests/fixtures/multisurface.gpkg +0 -0
  27. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/tests/test_arrow.py +181 -24
  28. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/tests/test_core.py +170 -76
  29. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/tests/test_geopandas_io.py +483 -135
  30. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/tests/test_path.py +39 -17
  31. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/tests/test_raw_io.py +170 -55
  32. pyogrio-0.11.0/pyogrio/tests/test_util.py +56 -0
  33. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/util.py +69 -32
  34. pyogrio-0.11.0/pyogrio.egg-info/PKG-INFO +124 -0
  35. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio.egg-info/SOURCES.txt +5 -7
  36. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio.egg-info/requires.txt +1 -1
  37. pyogrio-0.11.0/pyproject.toml +214 -0
  38. {pyogrio-0.9.0 → pyogrio-0.11.0}/setup.py +3 -18
  39. pyogrio-0.9.0/PKG-INFO +0 -100
  40. pyogrio-0.9.0/README.md +0 -76
  41. pyogrio-0.9.0/pyogrio/_err.pxd +0 -4
  42. pyogrio-0.9.0/pyogrio/_err.pyx +0 -250
  43. pyogrio-0.9.0/pyogrio/_vsi.pyx +0 -140
  44. pyogrio-0.9.0/pyogrio/tests/conftest.py +0 -204
  45. pyogrio-0.9.0/pyogrio/tests/fixtures/poly_not_enough_points.shp.zip +0 -0
  46. pyogrio-0.9.0/pyogrio/tests/fixtures/test_datetime.geojson +0 -7
  47. pyogrio-0.9.0/pyogrio/tests/fixtures/test_datetime_tz.geojson +0 -8
  48. pyogrio-0.9.0/pyogrio/tests/fixtures/test_fgdb.gdb.zip +0 -0
  49. pyogrio-0.9.0/pyogrio/tests/fixtures/test_nested.geojson +0 -18
  50. pyogrio-0.9.0/pyogrio/tests/fixtures/test_ogr_types_list.geojson +0 -12
  51. pyogrio-0.9.0/pyogrio.egg-info/PKG-INFO +0 -100
  52. pyogrio-0.9.0/pyproject.toml +0 -66
  53. {pyogrio-0.9.0 → pyogrio-0.11.0}/MANIFEST.in +0 -0
  54. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/_io.pxd +0 -0
  55. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/arrow_bridge.h +0 -0
  56. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/tests/__init__.py +0 -0
  57. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.cpg +0 -0
  58. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.dbf +0 -0
  59. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.prj +0 -0
  60. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.shp +0 -0
  61. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.shx +0 -0
  62. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/tests/fixtures/sample.osm.pbf +0 -0
  63. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio/tests/fixtures/test_gpkg_nulls.gpkg +0 -0
  64. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio.egg-info/dependency_links.txt +0 -0
  65. {pyogrio-0.9.0 → pyogrio-0.11.0}/pyogrio.egg-info/top_level.txt +0 -0
  66. {pyogrio-0.9.0 → pyogrio-0.11.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020-2021 Brendan C. Ward and pyogrio contributors
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
@@ -0,0 +1,124 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyogrio
3
+ Version: 0.11.0
4
+ Summary: Vectorized spatial vector file format I/O using GDAL/OGR
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
39
+ Description-Content-Type: text/markdown
40
+ License-File: LICENSE
41
+ Requires-Dist: certifi
42
+ Requires-Dist: numpy
43
+ Requires-Dist: packaging
44
+ Provides-Extra: dev
45
+ Requires-Dist: cython; extra == "dev"
46
+ Provides-Extra: test
47
+ Requires-Dist: pytest; extra == "test"
48
+ Requires-Dist: pytest-cov; extra == "test"
49
+ Provides-Extra: benchmark
50
+ Requires-Dist: pytest-benchmark; extra == "benchmark"
51
+ Provides-Extra: geopandas
52
+ Requires-Dist: geopandas; extra == "geopandas"
53
+ Dynamic: license-file
54
+
55
+ # pyogrio - bulk-oriented spatial vector file I/O using GDAL/OGR
56
+
57
+ Pyogrio provides fast, bulk-oriented read and write access to
58
+ [GDAL/OGR](https://gdal.org/en/latest/drivers/vector/index.html) vector data
59
+ sources, such as ESRI Shapefile, GeoPackage, GeoJSON, and several others.
60
+ Vector data sources typically have geometries, such as points, lines, or
61
+ polygons, and associated records with potentially many columns worth of data.
62
+
63
+ The typical use is to read or write these data sources to/from
64
+ [GeoPandas](https://github.com/geopandas/geopandas) `GeoDataFrames`. Because
65
+ the geometry column is optional, reading or writing only non-spatial data is
66
+ also possible. Hence, GeoPackage attribute tables, DBF files, or CSV files are
67
+ also supported.
68
+
69
+ Pyogrio is fast because it uses pre-compiled bindings for GDAL/OGR to read and
70
+ write the data records in bulk. This approach avoids multiple steps of
71
+ converting to and from Python data types within Python, so performance becomes
72
+ primarily limited by the underlying I/O speed of data source drivers in
73
+ GDAL/OGR.
74
+
75
+ We have seen \>5-10x speedups reading files and \>5-20x speedups writing files
76
+ compared to using row-per-row approaches (e.g. Fiona).
77
+
78
+ Read the documentation for more information:
79
+ [https://pyogrio.readthedocs.io](https://pyogrio.readthedocs.io/en/latest/).
80
+
81
+ ## Requirements
82
+
83
+ Supports Python 3.9 - 3.13 and GDAL 3.4.x - 3.9.x.
84
+
85
+ Reading to GeoDataFrames requires `geopandas>=0.12` with `shapely>=2`.
86
+
87
+ Additionally, installing `pyarrow` in combination with GDAL 3.6+ enables
88
+ a further speed-up when specifying `use_arrow=True`.
89
+
90
+ ## Installation
91
+
92
+ Pyogrio is currently available on
93
+ [conda-forge](https://anaconda.org/conda-forge/pyogrio)
94
+ and [PyPI](https://pypi.org/project/pyogrio/)
95
+ for Linux, MacOS, and Windows.
96
+
97
+ Please read the
98
+ [installation documentation](https://pyogrio.readthedocs.io/en/latest/install.html)
99
+ for more information.
100
+
101
+ ## Supported vector formats
102
+
103
+ Pyogrio supports most common vector data source formats (provided they are also
104
+ supported by GDAL/OGR), including ESRI Shapefile, GeoPackage, GeoJSON, and
105
+ FlatGeobuf.
106
+
107
+ Please see the [list of supported formats](https://pyogrio.readthedocs.io/en/latest/supported_formats.html)
108
+ for more information.
109
+
110
+ ## Getting started
111
+
112
+ Please read the [introduction](https://pyogrio.readthedocs.io/en/latest/supported_formats.html)
113
+ for more information and examples to get started using Pyogrio.
114
+
115
+ You can also check out the [API documentation](https://pyogrio.readthedocs.io/en/latest/api.html)
116
+ for full details on using the API.
117
+
118
+ ## Credits
119
+
120
+ This project is made possible by the tremendous efforts of the GDAL, Fiona, and
121
+ Geopandas communities.
122
+
123
+ - Core I/O methods and supporting functions adapted from [Fiona](https://github.com/Toblerity/Fiona)
124
+ - Inspired by [Fiona PR](https://github.com/Toblerity/Fiona/pull/540/files)
@@ -0,0 +1,70 @@
1
+ # pyogrio - bulk-oriented spatial vector file I/O using GDAL/OGR
2
+
3
+ Pyogrio provides fast, bulk-oriented read and write access to
4
+ [GDAL/OGR](https://gdal.org/en/latest/drivers/vector/index.html) vector data
5
+ sources, such as ESRI Shapefile, GeoPackage, GeoJSON, and several others.
6
+ Vector data sources typically have geometries, such as points, lines, or
7
+ polygons, and associated records with potentially many columns worth of data.
8
+
9
+ The typical use is to read or write these data sources to/from
10
+ [GeoPandas](https://github.com/geopandas/geopandas) `GeoDataFrames`. Because
11
+ the geometry column is optional, reading or writing only non-spatial data is
12
+ also possible. Hence, GeoPackage attribute tables, DBF files, or CSV files are
13
+ also supported.
14
+
15
+ Pyogrio is fast because it uses pre-compiled bindings for GDAL/OGR to read and
16
+ write the data records in bulk. This approach avoids multiple steps of
17
+ converting to and from Python data types within Python, so performance becomes
18
+ primarily limited by the underlying I/O speed of data source drivers in
19
+ GDAL/OGR.
20
+
21
+ We have seen \>5-10x speedups reading files and \>5-20x speedups writing files
22
+ compared to using row-per-row approaches (e.g. Fiona).
23
+
24
+ Read the documentation for more information:
25
+ [https://pyogrio.readthedocs.io](https://pyogrio.readthedocs.io/en/latest/).
26
+
27
+ ## Requirements
28
+
29
+ Supports Python 3.9 - 3.13 and GDAL 3.4.x - 3.9.x.
30
+
31
+ Reading to GeoDataFrames requires `geopandas>=0.12` with `shapely>=2`.
32
+
33
+ Additionally, installing `pyarrow` in combination with GDAL 3.6+ enables
34
+ a further speed-up when specifying `use_arrow=True`.
35
+
36
+ ## Installation
37
+
38
+ Pyogrio is currently available on
39
+ [conda-forge](https://anaconda.org/conda-forge/pyogrio)
40
+ and [PyPI](https://pypi.org/project/pyogrio/)
41
+ for Linux, MacOS, and Windows.
42
+
43
+ Please read the
44
+ [installation documentation](https://pyogrio.readthedocs.io/en/latest/install.html)
45
+ for more information.
46
+
47
+ ## Supported vector formats
48
+
49
+ Pyogrio supports most common vector data source formats (provided they are also
50
+ supported by GDAL/OGR), including ESRI Shapefile, GeoPackage, GeoJSON, and
51
+ FlatGeobuf.
52
+
53
+ Please see the [list of supported formats](https://pyogrio.readthedocs.io/en/latest/supported_formats.html)
54
+ for more information.
55
+
56
+ ## Getting started
57
+
58
+ Please read the [introduction](https://pyogrio.readthedocs.io/en/latest/supported_formats.html)
59
+ for more information and examples to get started using Pyogrio.
60
+
61
+ You can also check out the [API documentation](https://pyogrio.readthedocs.io/en/latest/api.html)
62
+ for full details on using the API.
63
+
64
+ ## Credits
65
+
66
+ This project is made possible by the tremendous efforts of the GDAL, Fiona, and
67
+ Geopandas communities.
68
+
69
+ - Core I/O methods and supporting functions adapted from [Fiona](https://github.com/Toblerity/Fiona)
70
+ - Inspired by [Fiona PR](https://github.com/Toblerity/Fiona/pull/540/files)
@@ -1,48 +1,55 @@
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
29
33
 
30
34
  __all__ = [
31
- "list_drivers",
35
+ "__gdal_geos_version__",
36
+ "__gdal_version__",
37
+ "__gdal_version_string__",
38
+ "__version__",
32
39
  "detect_write_driver",
40
+ "get_gdal_config_option",
41
+ "get_gdal_data_path",
42
+ "list_drivers",
33
43
  "list_layers",
44
+ "open_arrow",
45
+ "read_arrow",
34
46
  "read_bounds",
47
+ "read_dataframe",
35
48
  "read_info",
36
49
  "set_gdal_config_options",
37
- "get_gdal_config_option",
38
- "get_gdal_data_path",
39
- "read_arrow",
40
- "open_arrow",
50
+ "vsi_listtree",
51
+ "vsi_rmtree",
52
+ "vsi_unlink",
41
53
  "write_arrow",
42
- "read_dataframe",
43
54
  "write_dataframe",
44
- "__gdal_version__",
45
- "__gdal_version_string__",
46
- "__gdal_geos_version__",
47
- "__version__",
48
55
  ]
@@ -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,15 +32,24 @@ 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
36
+ PYARROW_GE_19 = pyarrow is not None and Version(pyarrow.__version__) >= Version(
37
+ "19.0.0"
38
+ )
30
39
 
31
40
  HAS_GEOPANDAS = geopandas is not None
32
41
 
33
42
  PANDAS_GE_15 = pandas is not None and Version(pandas.__version__) >= Version("1.5.0")
34
43
  PANDAS_GE_20 = pandas is not None and Version(pandas.__version__) >= Version("2.0.0")
35
44
  PANDAS_GE_22 = pandas is not None and Version(pandas.__version__) >= Version("2.2.0")
45
+ PANDAS_GE_30 = pandas is not None and Version(pandas.__version__) >= Version("3.0.0dev")
36
46
 
47
+ GDAL_GE_352 = __gdal_version__ >= (3, 5, 2)
48
+ GDAL_GE_37 = __gdal_version__ >= (3, 7, 0)
37
49
  GDAL_GE_38 = __gdal_version__ >= (3, 8, 0)
50
+ GDAL_GE_311 = __gdal_version__ >= (3, 11, 0)
38
51
 
39
52
  HAS_GDAL_GEOS = __gdal_geos_version__ is not None
40
53
 
41
54
  HAS_SHAPELY = shapely is not None and Version(shapely.__version__) >= Version("2.0.0")
55
+ SHAPELY_GE_21 = shapely is not None and Version(shapely.__version__) >= Version("2.1.0")
@@ -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):
@@ -0,0 +1,9 @@
1
+ cdef object check_last_error()
2
+ cdef int check_int(int retval) except -1
3
+ cdef void *check_pointer(void *ptr) except NULL
4
+
5
+ cdef class ErrorHandler:
6
+ cdef object error_stack
7
+ cdef int check_int(self, int retval, bint squash_errors) except -1
8
+ cdef void *check_pointer(self, void *ptr, bint squash_errors) except NULL
9
+ cdef void _handle_error_stack(self, bint squash_errors)