Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_write_kml_file_coordinate_order fails with GDAL 3.10.0 #488

Closed
sebastic opened this issue Oct 18, 2024 · 1 comment · Fixed by #489
Closed

test_write_kml_file_coordinate_order fails with GDAL 3.10.0 #488

sebastic opened this issue Oct 18, 2024 · 1 comment · Fixed by #489

Comments

@sebastic
Copy link

The Debian package build failed with GDAL 3.10.0-beta1 due to test failures:

=================================== FAILURES ===================================
_________________ test_write_kml_file_coordinate_order[False] __________________

tmp_path = PosixPath('/tmp/pytest-of-pbuilder/pytest-0/test_write_kml_file_coordinate0')
use_arrow = False

    @pytest.mark.requires_arrow_write_api
    def test_write_kml_file_coordinate_order(tmp_path, use_arrow):
        # confirm KML coordinates are written in lon, lat order even if CRS axis
        # specifies otherwise
        points = [Point(10, 20), Point(30, 40), Point(50, 60)]
        gdf = gp.GeoDataFrame(geometry=points, crs="EPSG:4326")
        output_path = tmp_path / "test.kml"
        write_dataframe(
            gdf, output_path, layer="tmp_layer", driver="KML", use_arrow=use_arrow
        )
    
        gdf_in = read_dataframe(output_path, use_arrow=use_arrow)
    
        assert np.array_equal(gdf_in.geometry.values, points)
    
        if "LIBKML" in list_drivers():
            # test appending to the existing file only if LIBKML is available
            # as it appears to fall back on LIBKML driver when appending.
            points_append = [Point(70, 80), Point(90, 100), Point(110, 120)]
            gdf_append = gp.GeoDataFrame(geometry=points_append, crs="EPSG:4326")
    
>           write_dataframe(
                gdf_append,
                output_path,
                layer="tmp_layer",
                driver="KML",
                use_arrow=use_arrow,
                append=True,
            )

pyogrio/tests/test_geopandas_io.py:2263: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pyogrio/geopandas.py:662: in write_dataframe
    write(
pyogrio/raw.py:723: in write
    ogr_write(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   pyogrio.errors.FeatureError: Could not add feature to layer at index 1: Cannot translate feature: OGRFeature(tmp_layer):-1   POINT (90 100)

pyogrio/_io.pyx:2495: FeatureError
=============================== warnings summary ===============================
.pybuild/cpython3_3.12_pyogrio/build/pyogrio/tests/test_geopandas_io.py: 11 warnings
  /usr/lib/python3/dist-packages/pandas/core/generic.py:6313: DeprecationWarning: Overriding the CRS of a GeoDataFrame that already has CRS. This unsafe behavior will be deprecated in future versions. Use GeoDataFrame.set_crs method instead
    return object.__setattr__(self, name, value)

.pybuild/cpython3_3.12_pyogrio/build/pyogrio/tests/test_raw_io.py::test_write_gdalclose_error
  /build/pyogrio-0.10.0+ds/.pybuild/cpython3_3.12_pyogrio/build/pyogrio/raw.py:723: RuntimeWarning: HTTP response code on https://non-existing-bucket.s3.us-east-1.amazonaws.com/test.geojson: 0
    ogr_write(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED pyogrio/tests/test_geopandas_io.py::test_write_kml_file_coordinate_order[False]
=== 1 failed, 713 passed, 381 skipped, 40 deselected, 12 warnings in 16.99s ====
@rouault
Copy link
Contributor

rouault commented Oct 18, 2024

Cannot translate feature: OGRFeature(tmp_layer):-1 POINT (90 100)

The LIBKML driver now checks that latitudes are in [-90,90] range. Hence latitude=100 triggers the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants