pyogrio 0.9.0__cp39-cp39-macosx_12_0_x86_64.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/.dylibs/libgdal.34.3.8.5.dylib +0 -0
- pyogrio/__init__.py +48 -0
- pyogrio/_compat.py +41 -0
- pyogrio/_env.py +61 -0
- pyogrio/_err.cpython-39-darwin.so +0 -0
- pyogrio/_err.pxd +4 -0
- pyogrio/_err.pyx +250 -0
- pyogrio/_geometry.cpython-39-darwin.so +0 -0
- pyogrio/_geometry.pxd +4 -0
- pyogrio/_geometry.pyx +129 -0
- pyogrio/_io.cpython-39-darwin.so +0 -0
- pyogrio/_io.pxd +0 -0
- pyogrio/_io.pyx +2742 -0
- pyogrio/_ogr.cpython-39-darwin.so +0 -0
- pyogrio/_ogr.pxd +444 -0
- pyogrio/_ogr.pyx +346 -0
- pyogrio/_version.py +21 -0
- pyogrio/_vsi.cpython-39-darwin.so +0 -0
- pyogrio/_vsi.pxd +4 -0
- pyogrio/_vsi.pyx +140 -0
- pyogrio/arrow_bridge.h +115 -0
- pyogrio/core.py +320 -0
- pyogrio/errors.py +32 -0
- pyogrio/gdal_data/GDAL-targets-release.cmake +19 -0
- pyogrio/gdal_data/GDAL-targets.cmake +105 -0
- pyogrio/gdal_data/GDALConfig.cmake +25 -0
- pyogrio/gdal_data/GDALConfigVersion.cmake +85 -0
- pyogrio/gdal_data/GDALLogoBW.svg +138 -0
- pyogrio/gdal_data/GDALLogoColor.svg +126 -0
- pyogrio/gdal_data/GDALLogoGS.svg +126 -0
- pyogrio/gdal_data/LICENSE.TXT +467 -0
- pyogrio/gdal_data/bag_template.xml +201 -0
- pyogrio/gdal_data/copyright +467 -0
- pyogrio/gdal_data/cubewerx_extra.wkt +48 -0
- pyogrio/gdal_data/default.rsc +0 -0
- pyogrio/gdal_data/ecw_cs.wkt +1453 -0
- pyogrio/gdal_data/eedaconf.json +23 -0
- pyogrio/gdal_data/epsg.wkt +1 -0
- pyogrio/gdal_data/esri_StatePlane_extra.wkt +631 -0
- pyogrio/gdal_data/gdalicon.png +0 -0
- pyogrio/gdal_data/gdalinfo_output.schema.json +346 -0
- pyogrio/gdal_data/gdalmdiminfo_output.schema.json +321 -0
- pyogrio/gdal_data/gdalvrt.xsd +772 -0
- pyogrio/gdal_data/gfs.xsd +246 -0
- pyogrio/gdal_data/gml_registry.xml +117 -0
- pyogrio/gdal_data/gml_registry.xsd +66 -0
- pyogrio/gdal_data/gmlasconf.xml +169 -0
- pyogrio/gdal_data/gmlasconf.xsd +1066 -0
- pyogrio/gdal_data/grib2_center.csv +251 -0
- pyogrio/gdal_data/grib2_process.csv +102 -0
- pyogrio/gdal_data/grib2_subcenter.csv +63 -0
- pyogrio/gdal_data/grib2_table_4_2_0_0.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_1.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_13.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_14.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_15.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_16.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_17.csv +11 -0
- pyogrio/gdal_data/grib2_table_4_2_0_18.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_19.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_190.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_191.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_2.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_20.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_21.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_3.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_4.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_5.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_6.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_0_7.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_10_0.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_10_1.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_10_191.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_10_2.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_10_3.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_10_4.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_1_0.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_1_1.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_1_2.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_20_0.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_20_1.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_20_2.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_2_0.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_2_3.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_2_4.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_2_5.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_2_6.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_3_0.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_3_1.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_3_2.csv +28 -0
- pyogrio/gdal_data/grib2_table_4_2_3_3.csv +8 -0
- pyogrio/gdal_data/grib2_table_4_2_3_4.csv +14 -0
- pyogrio/gdal_data/grib2_table_4_2_3_5.csv +11 -0
- pyogrio/gdal_data/grib2_table_4_2_3_6.csv +11 -0
- pyogrio/gdal_data/grib2_table_4_2_4_0.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_4_1.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_4_10.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_4_2.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_4_3.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_4_4.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_4_5.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_4_6.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_4_7.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_4_8.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_4_9.csv +261 -0
- pyogrio/gdal_data/grib2_table_4_2_local_Canada.csv +5 -0
- pyogrio/gdal_data/grib2_table_4_2_local_HPC.csv +2 -0
- pyogrio/gdal_data/grib2_table_4_2_local_MRMS.csv +175 -0
- pyogrio/gdal_data/grib2_table_4_2_local_NCEP.csv +401 -0
- pyogrio/gdal_data/grib2_table_4_2_local_NDFD.csv +38 -0
- pyogrio/gdal_data/grib2_table_4_2_local_index.csv +7 -0
- pyogrio/gdal_data/grib2_table_4_5.csv +261 -0
- pyogrio/gdal_data/grib2_table_versions.csv +3 -0
- pyogrio/gdal_data/gt_datum.csv +229 -0
- pyogrio/gdal_data/gt_ellips.csv +24 -0
- pyogrio/gdal_data/header.dxf +1124 -0
- pyogrio/gdal_data/inspire_cp_BasicPropertyUnit.gfs +57 -0
- pyogrio/gdal_data/inspire_cp_CadastralBoundary.gfs +60 -0
- pyogrio/gdal_data/inspire_cp_CadastralParcel.gfs +81 -0
- pyogrio/gdal_data/inspire_cp_CadastralZoning.gfs +161 -0
- pyogrio/gdal_data/jpfgdgml_AdmArea.gfs +59 -0
- pyogrio/gdal_data/jpfgdgml_AdmBdry.gfs +49 -0
- pyogrio/gdal_data/jpfgdgml_AdmPt.gfs +59 -0
- pyogrio/gdal_data/jpfgdgml_BldA.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_BldL.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_Cntr.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_CommBdry.gfs +49 -0
- pyogrio/gdal_data/jpfgdgml_CommPt.gfs +59 -0
- pyogrio/gdal_data/jpfgdgml_Cstline.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_ElevPt.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_GCP.gfs +94 -0
- pyogrio/gdal_data/jpfgdgml_LeveeEdge.gfs +49 -0
- pyogrio/gdal_data/jpfgdgml_RailCL.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_RdASL.gfs +44 -0
- pyogrio/gdal_data/jpfgdgml_RdArea.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_RdCompt.gfs +59 -0
- pyogrio/gdal_data/jpfgdgml_RdEdg.gfs +59 -0
- pyogrio/gdal_data/jpfgdgml_RdMgtBdry.gfs +49 -0
- pyogrio/gdal_data/jpfgdgml_RdSgmtA.gfs +59 -0
- pyogrio/gdal_data/jpfgdgml_RvrMgtBdry.gfs +49 -0
- pyogrio/gdal_data/jpfgdgml_SBAPt.gfs +49 -0
- pyogrio/gdal_data/jpfgdgml_SBArea.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_SBBdry.gfs +44 -0
- pyogrio/gdal_data/jpfgdgml_WA.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_WL.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_WStrA.gfs +54 -0
- pyogrio/gdal_data/jpfgdgml_WStrL.gfs +54 -0
- pyogrio/gdal_data/netcdf_config.xsd +143 -0
- pyogrio/gdal_data/nitf_spec.xml +3306 -0
- pyogrio/gdal_data/nitf_spec.xsd +189 -0
- pyogrio/gdal_data/ogrinfo_output.schema.json +505 -0
- pyogrio/gdal_data/ogrvrt.xsd +543 -0
- pyogrio/gdal_data/osmconf.ini +132 -0
- pyogrio/gdal_data/ozi_datum.csv +131 -0
- pyogrio/gdal_data/ozi_ellips.csv +35 -0
- pyogrio/gdal_data/pci_datum.txt +463 -0
- pyogrio/gdal_data/pci_ellips.txt +77 -0
- pyogrio/gdal_data/pdfcomposition.xsd +721 -0
- pyogrio/gdal_data/pds4_template.xml +65 -0
- pyogrio/gdal_data/plscenesconf.json +1985 -0
- pyogrio/gdal_data/ruian_vf_ob_v1.gfs +1455 -0
- pyogrio/gdal_data/ruian_vf_st_uvoh_v1.gfs +86 -0
- pyogrio/gdal_data/ruian_vf_st_v1.gfs +1489 -0
- pyogrio/gdal_data/ruian_vf_v1.gfs +2126 -0
- pyogrio/gdal_data/s57agencies.csv +249 -0
- pyogrio/gdal_data/s57attributes.csv +484 -0
- pyogrio/gdal_data/s57expectedinput.csv +1008 -0
- pyogrio/gdal_data/s57objectclasses.csv +287 -0
- pyogrio/gdal_data/seed_2d.dgn +0 -0
- pyogrio/gdal_data/seed_3d.dgn +0 -0
- pyogrio/gdal_data/stateplane.csv +259 -0
- pyogrio/gdal_data/template_tiles.mapml +28 -0
- pyogrio/gdal_data/tms_LINZAntarticaMapTileGrid.json +190 -0
- pyogrio/gdal_data/tms_MapML_APSTILE.json +268 -0
- pyogrio/gdal_data/tms_MapML_CBMTILE.json +346 -0
- pyogrio/gdal_data/tms_NZTM2000.json +243 -0
- pyogrio/gdal_data/trailer.dxf +434 -0
- pyogrio/gdal_data/usage +4 -0
- pyogrio/gdal_data/vcpkg-cmake-wrapper.cmake +23 -0
- pyogrio/gdal_data/vcpkg.spdx.json +264 -0
- pyogrio/gdal_data/vcpkg_abi_info.txt +41 -0
- pyogrio/gdal_data/vdv452.xml +367 -0
- pyogrio/gdal_data/vdv452.xsd +63 -0
- pyogrio/gdal_data/vicar.json +164 -0
- pyogrio/geopandas.py +675 -0
- pyogrio/proj_data/CH +22 -0
- pyogrio/proj_data/GL27 +23 -0
- pyogrio/proj_data/ITRF2000 +24 -0
- pyogrio/proj_data/ITRF2008 +94 -0
- pyogrio/proj_data/ITRF2014 +55 -0
- pyogrio/proj_data/copyright +34 -0
- pyogrio/proj_data/deformation_model.schema.json +582 -0
- pyogrio/proj_data/nad.lst +142 -0
- pyogrio/proj_data/nad27 +810 -0
- pyogrio/proj_data/nad83 +745 -0
- pyogrio/proj_data/other.extra +53 -0
- pyogrio/proj_data/proj-config-version.cmake +44 -0
- pyogrio/proj_data/proj-config.cmake +79 -0
- pyogrio/proj_data/proj-targets-release.cmake +19 -0
- pyogrio/proj_data/proj-targets.cmake +107 -0
- pyogrio/proj_data/proj.db +0 -0
- pyogrio/proj_data/proj.ini +51 -0
- pyogrio/proj_data/proj4-targets-release.cmake +19 -0
- pyogrio/proj_data/proj4-targets.cmake +107 -0
- pyogrio/proj_data/projjson.schema.json +1174 -0
- pyogrio/proj_data/triangulation.schema.json +214 -0
- pyogrio/proj_data/usage +4 -0
- pyogrio/proj_data/vcpkg.spdx.json +198 -0
- pyogrio/proj_data/vcpkg_abi_info.txt +27 -0
- pyogrio/proj_data/world +214 -0
- pyogrio/raw.py +871 -0
- pyogrio/tests/__init__.py +0 -0
- pyogrio/tests/conftest.py +204 -0
- pyogrio/tests/fixtures/README.md +89 -0
- pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.cpg +1 -0
- pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.dbf +0 -0
- pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.prj +1 -0
- pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.shp +0 -0
- pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.shx +0 -0
- pyogrio/tests/fixtures/poly_not_enough_points.shp.zip +0 -0
- pyogrio/tests/fixtures/sample.osm.pbf +0 -0
- pyogrio/tests/fixtures/test_datetime.geojson +7 -0
- pyogrio/tests/fixtures/test_datetime_tz.geojson +8 -0
- pyogrio/tests/fixtures/test_fgdb.gdb.zip +0 -0
- pyogrio/tests/fixtures/test_gpkg_nulls.gpkg +0 -0
- pyogrio/tests/fixtures/test_multisurface.gpkg +0 -0
- pyogrio/tests/fixtures/test_nested.geojson +18 -0
- pyogrio/tests/fixtures/test_ogr_types_list.geojson +12 -0
- pyogrio/tests/test_arrow.py +1041 -0
- pyogrio/tests/test_core.py +588 -0
- pyogrio/tests/test_geopandas_io.py +2174 -0
- pyogrio/tests/test_path.py +352 -0
- pyogrio/tests/test_raw_io.py +1404 -0
- pyogrio/util.py +223 -0
- pyogrio-0.9.0.dist-info/LICENSE +21 -0
- pyogrio-0.9.0.dist-info/METADATA +100 -0
- pyogrio-0.9.0.dist-info/RECORD +239 -0
- pyogrio-0.9.0.dist-info/WHEEL +5 -0
- pyogrio-0.9.0.dist-info/top_level.txt +1 -0
|
File without changes
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from zipfile import ZIP_DEFLATED, ZipFile
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
6
|
+
from pyogrio import (
|
|
7
|
+
__gdal_version_string__,
|
|
8
|
+
__version__,
|
|
9
|
+
list_drivers,
|
|
10
|
+
)
|
|
11
|
+
from pyogrio._compat import (
|
|
12
|
+
HAS_ARROW_API,
|
|
13
|
+
HAS_ARROW_WRITE_API,
|
|
14
|
+
HAS_GDAL_GEOS,
|
|
15
|
+
HAS_PYARROW,
|
|
16
|
+
HAS_SHAPELY,
|
|
17
|
+
)
|
|
18
|
+
from pyogrio.raw import read, write
|
|
19
|
+
|
|
20
|
+
_data_dir = Path(__file__).parent.resolve() / "fixtures"
|
|
21
|
+
|
|
22
|
+
# mapping of driver extension to driver name for well-supported drivers
|
|
23
|
+
DRIVERS = {
|
|
24
|
+
".fgb": "FlatGeobuf",
|
|
25
|
+
".geojson": "GeoJSON",
|
|
26
|
+
".geojsonl": "GeoJSONSeq",
|
|
27
|
+
".geojsons": "GeoJSONSeq",
|
|
28
|
+
".gpkg": "GPKG",
|
|
29
|
+
".shp": "ESRI Shapefile",
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
# mapping of driver name to extension
|
|
33
|
+
DRIVER_EXT = {driver: ext for ext, driver in DRIVERS.items()}
|
|
34
|
+
|
|
35
|
+
ALL_EXTS = [".fgb", ".geojson", ".geojsonl", ".gpkg", ".shp"]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def pytest_report_header(config):
|
|
39
|
+
drivers = ", ".join(
|
|
40
|
+
f"{driver}({capability})"
|
|
41
|
+
for driver, capability in sorted(list_drivers().items())
|
|
42
|
+
)
|
|
43
|
+
return (
|
|
44
|
+
f"pyogrio {__version__}\n"
|
|
45
|
+
f"GDAL {__gdal_version_string__}\n"
|
|
46
|
+
f"Supported drivers: {drivers}"
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
# marks to skip tests if optional dependecies are not present
|
|
51
|
+
requires_arrow_api = pytest.mark.skipif(not HAS_ARROW_API, reason="GDAL>=3.6 required")
|
|
52
|
+
requires_pyarrow_api = pytest.mark.skipif(
|
|
53
|
+
not HAS_ARROW_API or not HAS_PYARROW, reason="GDAL>=3.6 and pyarrow required"
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
requires_arrow_write_api = pytest.mark.skipif(
|
|
57
|
+
not HAS_ARROW_WRITE_API or not HAS_PYARROW,
|
|
58
|
+
reason="GDAL>=3.8 required for Arrow write API",
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
requires_gdal_geos = pytest.mark.skipif(
|
|
62
|
+
not HAS_GDAL_GEOS, reason="GDAL compiled with GEOS required"
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
requires_shapely = pytest.mark.skipif(not HAS_SHAPELY, reason="Shapely >= 2.0 required")
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def prepare_testfile(testfile_path, dst_dir, ext):
|
|
69
|
+
if ext == testfile_path.suffix:
|
|
70
|
+
return testfile_path
|
|
71
|
+
|
|
72
|
+
dst_path = dst_dir / f"{testfile_path.stem}{ext}"
|
|
73
|
+
if dst_path.exists():
|
|
74
|
+
return dst_path
|
|
75
|
+
|
|
76
|
+
meta, _, geometry, field_data = read(testfile_path)
|
|
77
|
+
|
|
78
|
+
if ext == ".fgb":
|
|
79
|
+
# For .fgb, spatial_index=False to avoid the rows being reordered
|
|
80
|
+
meta["spatial_index"] = False
|
|
81
|
+
# allow mixed Polygons/MultiPolygons type
|
|
82
|
+
meta["geometry_type"] = "Unknown"
|
|
83
|
+
|
|
84
|
+
elif ext == ".gpkg":
|
|
85
|
+
# For .gpkg, spatial_index=False to avoid the rows being reordered
|
|
86
|
+
meta["spatial_index"] = False
|
|
87
|
+
meta["geometry_type"] = "MultiPolygon"
|
|
88
|
+
|
|
89
|
+
write(dst_path, geometry, field_data, **meta)
|
|
90
|
+
return dst_path
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
@pytest.fixture(scope="session")
|
|
94
|
+
def data_dir():
|
|
95
|
+
return _data_dir
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@pytest.fixture(scope="function")
|
|
99
|
+
def naturalearth_lowres(tmp_path, request):
|
|
100
|
+
ext = getattr(request, "param", ".shp")
|
|
101
|
+
testfile_path = _data_dir / Path("naturalearth_lowres/naturalearth_lowres.shp")
|
|
102
|
+
|
|
103
|
+
return prepare_testfile(testfile_path, tmp_path, ext)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
@pytest.fixture(scope="function", params=ALL_EXTS)
|
|
107
|
+
def naturalearth_lowres_all_ext(tmp_path, naturalearth_lowres, request):
|
|
108
|
+
return prepare_testfile(naturalearth_lowres, tmp_path, request.param)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
@pytest.fixture(scope="function")
|
|
112
|
+
def naturalearth_lowres_vsi(tmp_path, naturalearth_lowres):
|
|
113
|
+
"""Wrap naturalearth_lowres as a zip file for vsi tests"""
|
|
114
|
+
|
|
115
|
+
path = tmp_path / f"{naturalearth_lowres.name}.zip"
|
|
116
|
+
with ZipFile(path, mode="w", compression=ZIP_DEFLATED, compresslevel=5) as out:
|
|
117
|
+
for ext in ["dbf", "prj", "shp", "shx", "cpg"]:
|
|
118
|
+
filename = f"{naturalearth_lowres.stem}.{ext}"
|
|
119
|
+
out.write(naturalearth_lowres.parent / filename, filename)
|
|
120
|
+
|
|
121
|
+
return path, f"/vsizip/{path}/{naturalearth_lowres.name}"
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
@pytest.fixture(scope="session")
|
|
125
|
+
def test_fgdb_vsi():
|
|
126
|
+
return f"/vsizip/{_data_dir}/test_fgdb.gdb.zip"
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
@pytest.fixture(scope="session")
|
|
130
|
+
def test_gpkg_nulls():
|
|
131
|
+
return _data_dir / "test_gpkg_nulls.gpkg"
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
@pytest.fixture(scope="session")
|
|
135
|
+
def test_ogr_types_list():
|
|
136
|
+
return _data_dir / "test_ogr_types_list.geojson"
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
@pytest.fixture(scope="session")
|
|
140
|
+
def test_datetime():
|
|
141
|
+
return _data_dir / "test_datetime.geojson"
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
@pytest.fixture(scope="session")
|
|
145
|
+
def test_datetime_tz():
|
|
146
|
+
return _data_dir / "test_datetime_tz.geojson"
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
@pytest.fixture(scope="function")
|
|
150
|
+
def geojson_bytes(tmp_path):
|
|
151
|
+
"""Extracts first 3 records from naturalearth_lowres and writes to GeoJSON,
|
|
152
|
+
returning bytes"""
|
|
153
|
+
meta, _, geometry, field_data = read(
|
|
154
|
+
_data_dir / Path("naturalearth_lowres/naturalearth_lowres.shp"), max_features=3
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
filename = tmp_path / "test.geojson"
|
|
158
|
+
write(filename, geometry, field_data, **meta)
|
|
159
|
+
|
|
160
|
+
with open(filename, "rb") as f:
|
|
161
|
+
bytes_buffer = f.read()
|
|
162
|
+
|
|
163
|
+
return bytes_buffer
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
@pytest.fixture(scope="function")
|
|
167
|
+
def geojson_filelike(tmp_path):
|
|
168
|
+
"""Extracts first 3 records from naturalearth_lowres and writes to GeoJSON,
|
|
169
|
+
returning open file handle"""
|
|
170
|
+
meta, _, geometry, field_data = read(
|
|
171
|
+
_data_dir / Path("naturalearth_lowres/naturalearth_lowres.shp"), max_features=3
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
filename = tmp_path / "test.geojson"
|
|
175
|
+
write(filename, geometry, field_data, layer="test", **meta)
|
|
176
|
+
|
|
177
|
+
with open(filename, "rb") as f:
|
|
178
|
+
yield f
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
@pytest.fixture(
|
|
182
|
+
scope="session",
|
|
183
|
+
params=[
|
|
184
|
+
# Japanese
|
|
185
|
+
("CP932", "ホ"),
|
|
186
|
+
# Chinese
|
|
187
|
+
("CP936", "中文"),
|
|
188
|
+
# Central European
|
|
189
|
+
("CP1250", "Đ"),
|
|
190
|
+
# Latin 1 / Western European
|
|
191
|
+
("CP1252", "ÿ"),
|
|
192
|
+
# Greek
|
|
193
|
+
("CP1253", "Φ"),
|
|
194
|
+
# Arabic
|
|
195
|
+
("CP1256", "ش"),
|
|
196
|
+
],
|
|
197
|
+
)
|
|
198
|
+
def encoded_text(request):
|
|
199
|
+
"""Return tuple with encoding name and very short sample text in that encoding
|
|
200
|
+
NOTE: it was determined through testing that code pages for MS-DOS do not
|
|
201
|
+
consistently work across all Python installations (in particular, fail with conda),
|
|
202
|
+
but ANSI code pages appear to work properly.
|
|
203
|
+
"""
|
|
204
|
+
return request.param
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Test datasets
|
|
2
|
+
|
|
3
|
+
## Natural Earth lowres
|
|
4
|
+
|
|
5
|
+
`naturalearth_lowres.shp` was copied from GeoPandas.
|
|
6
|
+
|
|
7
|
+
## FGDB test dataset
|
|
8
|
+
|
|
9
|
+
`test_fgdb.gdb.zip`
|
|
10
|
+
Downloaded from http://trac.osgeo.org/gdal/raw-attachment/wiki/FileGDB/test_fgdb.gdb.zip
|
|
11
|
+
|
|
12
|
+
### GPKG test dataset with null values
|
|
13
|
+
|
|
14
|
+
`test_gpkg_nulls.gpkg` was created using Fiona backend to GeoPandas:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
from collections import OrderedDict
|
|
18
|
+
|
|
19
|
+
import fiona
|
|
20
|
+
import geopandas as gp
|
|
21
|
+
import numpy as np
|
|
22
|
+
from pyogrio import write_dataframe
|
|
23
|
+
|
|
24
|
+
filename = "test_gpkg_nulls.gpkg"
|
|
25
|
+
|
|
26
|
+
df = gp.GeoDataFrame(
|
|
27
|
+
{
|
|
28
|
+
"col_bool": np.array([True, False, True], dtype="bool"),
|
|
29
|
+
"col_int8": np.array([1, 2, 3], dtype="int8"),
|
|
30
|
+
"col_int16": np.array([1, 2, 3], dtype="int16"),
|
|
31
|
+
"col_int32": np.array([1, 2, 3], dtype="int32"),
|
|
32
|
+
"col_int64": np.array([1, 2, 3], dtype="int64"),
|
|
33
|
+
"col_uint8": np.array([1, 2, 3], dtype="uint8"),
|
|
34
|
+
"col_uint16": np.array([1, 2, 3], dtype="uint16"),
|
|
35
|
+
"col_uint32": np.array([1, 2, 3], dtype="uint32"),
|
|
36
|
+
"col_uint64": np.array([1, 2, 3], dtype="uint64"),
|
|
37
|
+
"col_float32": np.array([1.5, 2.5, 3.5], dtype="float32"),
|
|
38
|
+
"col_float64": np.array([1.5, 2.5, 3.5], dtype="float64"),
|
|
39
|
+
},
|
|
40
|
+
geometry=gp.points_from_xy([0, 1, 2], [0, 1, 2]),
|
|
41
|
+
crs="EPSG:4326",
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
write_dataframe(df, filename)
|
|
45
|
+
|
|
46
|
+
# construct row with null values
|
|
47
|
+
# Note: np.nan can only be used for float values
|
|
48
|
+
null_row = {
|
|
49
|
+
"type": "Fetaure",
|
|
50
|
+
"id": 4,
|
|
51
|
+
"properties": OrderedDict(
|
|
52
|
+
[
|
|
53
|
+
("col_bool", None),
|
|
54
|
+
("col_int8", None),
|
|
55
|
+
("col_int16", None),
|
|
56
|
+
("col_int32", None),
|
|
57
|
+
("col_int64", None),
|
|
58
|
+
("col_uint8", None),
|
|
59
|
+
("col_uint16", None),
|
|
60
|
+
("col_uint32", None),
|
|
61
|
+
("col_uint64", None),
|
|
62
|
+
("col_float32", np.nan),
|
|
63
|
+
("col_float64", np.nan),
|
|
64
|
+
]
|
|
65
|
+
),
|
|
66
|
+
"geometry": {"type": "Point", "coordinates": (4.0, 4.0)},
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
# append row with nulls to GPKG
|
|
70
|
+
with fiona.open(filename, "a") as c:
|
|
71
|
+
c.write(null_row)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
NOTE: Reading boolean values into GeoPandas using Fiona backend treats those
|
|
75
|
+
values as `None` and column dtype as `object`; Pyogrio treats those values as
|
|
76
|
+
`np.nan` and column dtype as `float64`.
|
|
77
|
+
|
|
78
|
+
### GPKG test with MultiSurface
|
|
79
|
+
|
|
80
|
+
This was extracted from https://prd-tnm.s3.amazonaws.com/StagedProducts/Hydrography/NHDPlusHR/Beta/GDB/NHDPLUS_H_0308_HU4_GDB.zip
|
|
81
|
+
`NHDWaterbody` layer using ogr2ogr:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
ogr2ogr test_mixed_surface.gpkg NHDPLUS_H_0308_HU4_GDB.gdb NHDWaterbody -where '"NHDPlusID" = 15000300070477' -select "NHDPlusID"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### OSM PBF test
|
|
88
|
+
|
|
89
|
+
This was downloaded from https://github.com/openstreetmap/OSM-binary/blob/master/resources/sample.pbf
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ISO-8859-1
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "FeatureCollection",
|
|
3
|
+
"features": [
|
|
4
|
+
{ "type": "Feature", "properties": { "col": "2020-01-01T09:00:00.123" }, "geometry": { "type": "Point", "coordinates": [ 1.0, 1.0 ] } },
|
|
5
|
+
{ "type": "Feature", "properties": { "col": "2020-01-01T10:00:00" }, "geometry": { "type": "Point", "coordinates": [ 2.0, 2.0 ] } }
|
|
6
|
+
]
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "FeatureCollection",
|
|
3
|
+
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
|
|
4
|
+
"features": [
|
|
5
|
+
{ "type": "Feature", "properties": { "datetime_col": "2020-01-01T09:00:00.123-05:00" }, "geometry": { "type": "Point", "coordinates": [ 1.0, 1.0 ] } },
|
|
6
|
+
{ "type": "Feature", "properties": { "datetime_col": "2020-01-01T10:00:00-05:00" }, "geometry": { "type": "Point", "coordinates": [ 2.0, 2.0 ] } }
|
|
7
|
+
]
|
|
8
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "FeatureCollection",
|
|
3
|
+
"features": [
|
|
4
|
+
{
|
|
5
|
+
"type": "Feature",
|
|
6
|
+
"geometry": {
|
|
7
|
+
"type": "Point",
|
|
8
|
+
"coordinates": [0, 0]
|
|
9
|
+
},
|
|
10
|
+
"properties": {
|
|
11
|
+
"top_level": "A",
|
|
12
|
+
"intermediate_level": {
|
|
13
|
+
"bottom_level": "B"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "FeatureCollection",
|
|
3
|
+
"name": "test",
|
|
4
|
+
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
|
|
5
|
+
"features": [
|
|
6
|
+
{ "type": "Feature", "properties": { "int64": 1, "list_int64": [ 0, 1 ] }, "geometry": { "type": "Point", "coordinates": [ 0.0, 2.0 ] } },
|
|
7
|
+
{ "type": "Feature", "properties": { "int64": 2, "list_int64": [ 2, 3 ] }, "geometry": { "type": "Point", "coordinates": [ 1.0, 2.0 ] } },
|
|
8
|
+
{ "type": "Feature", "properties": { "int64": 3, "list_int64": [ 4, 5 ] }, "geometry": { "type": "Point", "coordinates": [ 2.0, 2.0 ] } },
|
|
9
|
+
{ "type": "Feature", "properties": { "int64": 4, "list_int64": [ 6, 7 ] }, "geometry": { "type": "Point", "coordinates": [ 3.0, 2.0 ] } },
|
|
10
|
+
{ "type": "Feature", "properties": { "int64": 5, "list_int64": [ 8, 9 ] }, "geometry": { "type": "Point", "coordinates": [ 4.0, 2.0 ] } }
|
|
11
|
+
]
|
|
12
|
+
}
|