|
20 | 20 | DRIVERS,
|
21 | 21 | requires_pyarrow_api,
|
22 | 22 | requires_arrow_write_api,
|
| 23 | + requires_pyproj, |
23 | 24 | requires_gdal_geos,
|
24 | 25 | )
|
25 |
| -from pyogrio._compat import PANDAS_GE_15, HAS_ARROW_WRITE_API |
| 26 | +from pyogrio._compat import HAS_PYPROJ, PANDAS_GE_15, HAS_ARROW_WRITE_API |
26 | 27 |
|
27 | 28 | try:
|
28 | 29 | import pandas as pd
|
@@ -126,7 +127,8 @@ def test_read_csv_platform_encoding(tmp_path):
|
126 | 127 | def test_read_dataframe(naturalearth_lowres_all_ext):
|
127 | 128 | df = read_dataframe(naturalearth_lowres_all_ext)
|
128 | 129 |
|
129 |
| - assert df.crs == "EPSG:4326" |
| 130 | + if HAS_PYPROJ: |
| 131 | + assert df.crs == "EPSG:4326" |
130 | 132 | assert len(df) == 177
|
131 | 133 | assert df.columns.tolist() == [
|
132 | 134 | "pop_est",
|
@@ -1071,6 +1073,8 @@ def test_write_empty_geometry(tmp_path):
|
1071 | 1073 | # Check that no warning is raised with GeoSeries.notna()
|
1072 | 1074 | with warnings.catch_warnings():
|
1073 | 1075 | warnings.simplefilter("error", UserWarning)
|
| 1076 | + if not HAS_PYPROJ: |
| 1077 | + warnings.filterwarnings("ignore", message="'crs' was not provided.") |
1074 | 1078 | write_dataframe(expected, filename)
|
1075 | 1079 | assert filename.exists()
|
1076 | 1080 |
|
@@ -1460,6 +1464,7 @@ def test_write_dataframe_infer_geometry_with_nulls(tmp_path, geoms, ext, use_arr
|
1460 | 1464 | "ignore: You will likely lose important projection information"
|
1461 | 1465 | )
|
1462 | 1466 | @pytest.mark.requires_arrow_write_api
|
| 1467 | +@requires_pyproj |
1463 | 1468 | def test_custom_crs_io(tmp_path, naturalearth_lowres_all_ext, use_arrow):
|
1464 | 1469 | df = read_dataframe(naturalearth_lowres_all_ext)
|
1465 | 1470 | # project Belgium to a custom Albers Equal Area projection
|
|
0 commit comments