From 6a5ba2362c23ceca9322f98dd2706df8a1372cb0 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Tue, 22 Oct 2024 10:15:52 +0200 Subject: [PATCH] updates after merged creation PR --- src/io.cpp | 5 ++--- tests/test_io.py | 12 ++++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/io.cpp b/src/io.cpp index 1b49b79..a18c1aa 100644 --- a/src/io.cpp +++ b/src/io.cpp @@ -2,6 +2,7 @@ #include #include "constants.hpp" +#include "creation.hpp" #include "geography.hpp" #include "pybind11.hpp" @@ -31,9 +32,7 @@ class FromWKT { } PyObjectGeography operator()(py::str a) const { - std::unique_ptr s2geog = m_reader->read_feature(a); - auto geog_ptr = std::make_unique(std::move(s2geog)); - return PyObjectGeography::from_geog(std::move(geog_ptr)); + return make_py_geography(m_reader->read_feature(a)); } private: diff --git a/tests/test_io.py b/tests/test_io.py index 85d551e..a44ca45 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -7,7 +7,7 @@ def test_from_wkt(): result = spherely.from_wkt(["POINT (1 1)", "POINT(2 2)", "POINT(3 3)"]) - expected = spherely.create([1, 2, 3], [1, 2, 3]) + expected = spherely.points([1, 2, 3], [1, 2, 3]) # object equality does not yet work # np.testing.assert_array_equal(result, expected) assert spherely.equals(result, expected).all() @@ -70,20 +70,20 @@ def test_from_wkt_oriented(): ) def test_from_wkt_planar(): result = spherely.from_wkt("LINESTRING (-64 45, 0 45)") - assert spherely.distance(result, spherely.Point(45, -30.1)) > 10000 + assert spherely.distance(result, spherely.point(-30.1, 45)) > 10000 result = spherely.from_wkt("LINESTRING (-64 45, 0 45)", planar=True) - assert spherely.distance(result, spherely.Point(45, -30.1)) < 100 + assert spherely.distance(result, spherely.point(-30.1, 45)) < 100 result = spherely.from_wkt( "LINESTRING (-64 45, 0 45)", planar=True, tessellate_tol_m=10 ) - assert spherely.distance(result, spherely.Point(45, -30.1)) < 10 + assert spherely.distance(result, spherely.point(-30.1, 45)) < 10 @pytest.mark.skipif( Version(spherely.__s2geography_version__) >= Version("0.2.0"), - reason="Needs s2geography >= 0.2.0", + reason="Needs s2geography < 0.2.0", ) def test_from_wkt_unsupported_keywords(): @@ -95,7 +95,7 @@ def test_from_wkt_unsupported_keywords(): def test_to_wkt(): - arr = spherely.create([1.1, 2, 3], [1.1, 2, 3]) + arr = spherely.points([1.1, 2, 3], [1.1, 2, 3]) result = spherely.to_wkt(arr) expected = np.array(["POINT (1.1 1.1)", "POINT (2 2)", "POINT (3 3)"], dtype=object) np.testing.assert_array_equal(result, expected)