[geos-commits] [SCM] GEOS branch master updated. 3e3bf5074031cf86a10a017bddfdf693389a322f

git at osgeo.org git at osgeo.org
Sat Nov 28 12:29:03 PST 2020


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".

The branch, master has been updated
       via  3e3bf5074031cf86a10a017bddfdf693389a322f (commit)
       via  b8cc3850e31f5d13a9ac79e416209da041fdb83b (commit)
       via  f1074ea2ad4a09543bb3df2c136d5f89a9dac982 (commit)
       via  3997aae9feaebbe5d5295b67d41a5d941b7d0664 (commit)
       via  48d02f65db373bf915ad225a9385c5713077c39e (commit)
      from  166faaea066d129999af7e7897ea994627bc097f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3e3bf5074031cf86a10a017bddfdf693389a322f
Merge: f1074ea b8cc385
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Sat Nov 28 12:28:47 2020 -0800

    Merge branch 'jorisvandenbossche-fix-setordinate-error'


commit b8cc3850e31f5d13a9ac79e416209da041fdb83b
Merge: f1074ea 48d02f6
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Sat Nov 28 12:23:28 2020 -0800

    Merge branch 'fix-setordinate-error' of https://github.com/jorisvandenbossche/geos into jorisvandenbossche-fix-setordinate-error


commit f1074ea2ad4a09543bb3df2c136d5f89a9dac982
Merge: 3997aae 166faae
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Sat Nov 28 11:56:29 2020 -0800

    Merge branch 'master' of https://git.osgeo.org/gitea/geos/geos


commit 3997aae9feaebbe5d5295b67d41a5d941b7d0664
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Sat Nov 28 11:56:20 2020 -0800

    Add unit test that matches failure described by python community

diff --git a/tests/unit/capi/GEOSSTRtreeTest.cpp b/tests/unit/capi/GEOSSTRtreeTest.cpp
index daf2675..5d6c2a4 100644
--- a/tests/unit/capi/GEOSSTRtreeTest.cpp
+++ b/tests/unit/capi/GEOSSTRtreeTest.cpp
@@ -62,7 +62,6 @@ struct test_capistrtree_data {
 
         std::fprintf(stdout, "\n");
     }
-
 };
 
 typedef test_group<test_capistrtree_data> group;
@@ -259,6 +258,54 @@ void object::test<7>
     GEOSSTRtree_destroy(tree);
 }
 
+
+// querying tree with box
+template<>
+template<>
+void object::test<8>
+()
+{
+    GEOSSTRtree* tree = GEOSSTRtree_create(10);
+    GEOSGeometry* g = GEOSGeomFromWKT("POINT (2 3)");
+    GEOSSTRtree_insert(tree, g, g);
+    GEOSGeometry* q = GEOSGeomFromWKT("POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))");
+
+    typedef std::vector<GEOSGeometry*> GList;
+    GList geoms;
+    ensure_equals(geoms.size(), 0);
+    GEOSSTRtree_query(
+        tree,
+        q,
+        [](void* item, void* userdata) {
+            GList* geoms = (GList*)userdata;
+            geoms->push_back((GEOSGeometry*)item);
+        },
+        &geoms);
+
+    ensure_equals(geoms.size(), 1);
+    const GEOSCoordSequence* seq = GEOSGeom_getCoordSeq(geoms[0]);
+
+    double x = -1;
+    double y = -1;
+    GEOSCoordSeq_getXY(seq,  0, &x, &y);
+    ensure_equals(x, 2.0);
+    ensure_equals(y, 3.0);
+
+    GEOSGeom_destroy(q);
+    GEOSGeom_destroy(g);
+    GEOSSTRtree_destroy(tree);
+}
+
+
+// >>> import pygeos
+// >>> pygeos.geos_version
+// (3, 9, 0)
+// >>> point = pygeos.Geometry("POINT (2 3)")
+// >>> tree = pygeos.STRtree([point])
+// >>> tree.query(pygeos.box(0, 0, 10, 10))
+// array([], dtype=int64)
+
+
 } // namespace tut
 
 

commit 48d02f65db373bf915ad225a9385c5713077c39e
Author: Joris Van den Bossche <jorisvandenbossche at gmail.com>
Date:   Sat Nov 28 16:46:01 2020 +0100

    Fix return error code of GEOSCoordSeq_setOrdinate (closes #1078)

diff --git a/capi/geos_ts_c.cpp b/capi/geos_ts_c.cpp
index cbc94a8..a65e260 100644
--- a/capi/geos_ts_c.cpp
+++ b/capi/geos_ts_c.cpp
@@ -2164,7 +2164,7 @@ extern "C" {
     GEOSCoordSeq_setOrdinate_r(GEOSContextHandle_t extHandle, CoordinateSequence* cs,
                                unsigned int idx, unsigned int dim, double val)
     {
-        return execute(extHandle, 1, [&]() {
+        return execute(extHandle, 0, [&]() {
             cs->setOrdinate(idx, dim, val);
             return 1;
         });
diff --git a/include/geos/geom/FixedSizeCoordinateSequence.h b/include/geos/geom/FixedSizeCoordinateSequence.h
index 20e661d..0d5f228 100644
--- a/include/geos/geom/FixedSizeCoordinateSequence.h
+++ b/include/geos/geom/FixedSizeCoordinateSequence.h
@@ -74,7 +74,7 @@ namespace geom {
                     break;
                 default: {
                     std::stringstream ss;
-                    ss << "Unknown ordinate index " << index;
+                    ss << "Unknown ordinate index " << ordinateIndex;
                     throw geos::util::IllegalArgumentException(ss.str());
                     break;
                 }
diff --git a/src/geom/CoordinateArraySequence.cpp b/src/geom/CoordinateArraySequence.cpp
index f7015e2..22a5fe1 100644
--- a/src/geom/CoordinateArraySequence.cpp
+++ b/src/geom/CoordinateArraySequence.cpp
@@ -228,7 +228,7 @@ CoordinateArraySequence::setOrdinate(size_t index, size_t ordinateIndex,
         break;
     default: {
         std::stringstream ss;
-        ss << "Unknown ordinate index " << index;
+        ss << "Unknown ordinate index " << ordinateIndex;
         throw util::IllegalArgumentException(ss.str());
         break;
     }
diff --git a/tests/unit/capi/GEOSCoordSeqTest.cpp b/tests/unit/capi/GEOSCoordSeqTest.cpp
index 05a59f1..b7da46c 100644
--- a/tests/unit/capi/GEOSCoordSeqTest.cpp
+++ b/tests/unit/capi/GEOSCoordSeqTest.cpp
@@ -151,9 +151,9 @@ void object::test<3>
     double z = 12;
 
     // X, Y, Z
-    GEOSCoordSeq_setOrdinate(cs_, 0, 0, x);
-    GEOSCoordSeq_setOrdinate(cs_, 0, 1, y);
-    GEOSCoordSeq_setOrdinate(cs_, 0, 2, z);
+    ensure(0 != GEOSCoordSeq_setOrdinate(cs_, 0, 0, x));
+    ensure(0 != GEOSCoordSeq_setOrdinate(cs_, 0, 1, y));
+    ensure(0 != GEOSCoordSeq_setOrdinate(cs_, 0, 2, z));
 
     double xcheck, ycheck, zcheck;
     ensure(0 != GEOSCoordSeq_getOrdinate(cs_, 0, 1, &ycheck));
@@ -163,6 +163,9 @@ void object::test<3>
     ensure_equals(xcheck, x);
     ensure_equals(ycheck, y);
     ensure_equals(zcheck, z);
+
+    // correct error on wrong ordinate index
+    ensure(0 == GEOSCoordSeq_setOrdinate(cs_, 0, 3, z));
 }
 
 // Test swapped setX calls (see bug #133, fixed)

-----------------------------------------------------------------------

Summary of changes:
 capi/geos_ts_c.cpp                              |  2 +-
 include/geos/geom/FixedSizeCoordinateSequence.h |  2 +-
 src/geom/CoordinateArraySequence.cpp            |  2 +-
 tests/unit/capi/GEOSCoordSeqTest.cpp            |  9 +++--
 tests/unit/capi/GEOSSTRtreeTest.cpp             | 49 ++++++++++++++++++++++++-
 5 files changed, 57 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list