[geos-commits] [SCM] GEOS branch main updated. ae3c56ff62534d8a719dfedac43a5c199f0fd8a6

git at osgeo.org git at osgeo.org
Tue Jun 27 11:30:03 PDT 2023


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, main has been updated
       via  ae3c56ff62534d8a719dfedac43a5c199f0fd8a6 (commit)
       via  2431823ce475d6ffa821f460adfa2cefdb861e28 (commit)
      from  54177f2da3d9b8f2903b1a6ed5f7837fda68aabc (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 ae3c56ff62534d8a719dfedac43a5c199f0fd8a6
Author: Mike Taves <mwtoews at gmail.com>
Date:   Wed Jun 28 06:29:55 2023 +1200

    CPack: ignore other files/dirs starting with .; use verbatim option (#928)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7a2906c73..e0a09e56f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -454,24 +454,22 @@ if(PROJECT_IS_TOP_LEVEL)
     set(CPACK_PACKAGE_VERSION_MINOR ${GEOS_VERSION_MINOR})
     set(CPACK_PACKAGE_VERSION_PATCH ${GEOS_VERSION_PATCH})
     set(CPACK_SOURCE_PACKAGE_FILE_NAME "geos-${GEOS_VERSION}")
-
+    set(CPACK_VERBATIM_VARIABLES TRUE)
     set(CPACK_SOURCE_IGNORE_FILES
-      "/\\\\.git"
-      "/autogen\\\\.sh"
-      "/tools/ci"
-      "/HOWTO_RELEASE"
-      "/autom4te\\\\.cache"
-      "\\\\.yml\$"
-      "\\\\.deps"
-      "/debian/"
-      "/php/"
-      "/.*build-.*/"
-      "cmake_install\\\\.cmake\$"
-      "/include/geos/version\\\\.h\$"
-      "/tools/geos-config\$"
-      "/tools/geos\\\\.pc\$"
-      "/bin/"
-      "/web/"
+      /\\..*  # any file/directory starting with .
+      /.*build.*/
+      /autogen\\.sh
+      /autom4te\\.cache
+      /bin/
+      /debian/
+      /HOWTO_RELEASE
+      /include/geos/version\\.h\$
+      /php/
+      /tools/ci
+      /tools/geos-config\$
+      /tools/geos\\.pc\$
+      /web/
+      cmake_install\\.cmake\$
       ${CMAKE_CURRENT_BINARY_DIR}
       )
 
diff --git a/HOWTO_RELEASE b/HOWTO_RELEASE
index 8e5b1af62..4df8b2c79 100644
--- a/HOWTO_RELEASE
+++ b/HOWTO_RELEASE
@@ -30,7 +30,7 @@
 
    $ BRANCH_NAME=main
    $ git clone --depth 1 --branch $BRANCH_NAME \
-         https://git.osgeo.org/gitea/geos/geos.git geos-$BRANCH_NAME
+         https://github.com/libgeos/geos.git geos-$BRANCH_NAME
    $ cd geos-$BRANCH_NAME
    $ mkdir _build && cd _build
    $ cmake ..

commit 2431823ce475d6ffa821f460adfa2cefdb861e28
Author: Casper van der Wel <caspervdw at gmail.com>
Date:   Tue Jun 27 20:29:45 2023 +0200

    Remove NaN point special case logic (#927)
    
    * Remove NaN point special case logic

diff --git a/NEWS.md b/NEWS.md
index 4a925da0e..94a366e5a 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -39,11 +39,13 @@
   - CoverageUnion now requires valid inputs to produce valid outputs
     and may return invalid outputs silently when fed invalid inputs.
     Use CoverageValidator first if you do not know the validity of your data.
+  - WKTReader: Points with all-NaN coordinates are not considered empty anymore (#..., Casper van der Wel)
 
 - Fixes/Improvements:
   - WKTReader: Fix parsing of Z and M flags in WKTReader (#676 and GH-669, Dan Baston)
   - WKTReader: Throw exception on inconsistent geometry dimension (#1080, Dan Baston)
   - WKTReader: Throw exception if WKT contains extra text after end of geometry (#1095, Dan Baston)
+  - WKTReader: Points with all-NaN coordinates are written as such (#..., Casper van der Wel)
   - GEOSIntersects: Fix crash with empty point inputs (#1110, Dan Baston)
   - GEOSIntersects: Improve performance/robustness by using PreparedGeometry algorithm (GH-775, Dan Baston)
   - LineMerger: Recursively collect all components from GeometryCollections (#401, Dan Baston)
diff --git a/capi/geos_ts_c.cpp b/capi/geos_ts_c.cpp
index 9c42927fc..69ea4f510 100644
--- a/capi/geos_ts_c.cpp
+++ b/capi/geos_ts_c.cpp
@@ -3785,7 +3785,7 @@ extern "C" {
             geos::linearref::LengthIndexedLine lil(g);
             geos::geom::Coordinate coord = lil.extractPoint(d);
             const GeometryFactory* gf = handle->geomFactory;
-            auto point = gf->createPoint(coord);
+            auto point = coord.isNull() ? gf->createPoint(g->getCoordinateDimension()) : gf->createPoint(coord);
             point->setSRID(g->getSRID());
             return point.release();
         });
diff --git a/include/geos/geom/CoordinateSequence.h b/include/geos/geom/CoordinateSequence.h
index 3070ec834..34a725bd3 100644
--- a/include/geos/geom/CoordinateSequence.h
+++ b/include/geos/geom/CoordinateSequence.h
@@ -197,20 +197,6 @@ public:
         return m_vect.empty();
     }
 
-    /// Returns <code>true</code> if there is 1 coordinate and if it is null.
-    bool isNullPoint() const {
-        if (size() != 1) {
-            return false;
-        }
-        switch(getCoordinateType()) {
-            case CoordinateType::XY: return getAt<CoordinateXY>(0).isNull();
-            case CoordinateType::XYZ: return getAt<Coordinate>(0).isNull();
-            case CoordinateType::XYZM: return getAt<CoordinateXYZM>(0).isNull();
-            case CoordinateType::XYM: return getAt<CoordinateXYM>(0).isNull();
-            default: return false;
-        }
-    }
-
     /** \brief
     * Tests whether an a {@link CoordinateSequence} forms a ring,
     * by checking length and closure. Self-intersection is not checked.
diff --git a/src/geom/GeometryFactory.cpp b/src/geom/GeometryFactory.cpp
index d30ee4906..881189fc2 100644
--- a/src/geom/GeometryFactory.cpp
+++ b/src/geom/GeometryFactory.cpp
@@ -226,8 +226,6 @@ GeometryFactory::createPoint(std::unique_ptr<CoordinateSequence>&& coords) const
 {
     if (!coords) {
         return createPoint();
-    } else if ((*coords).isNullPoint()) {
-        return createPoint((*coords).getDimension());
     }
     return std::unique_ptr<Point>(new Point(std::move(*coords), this));
 }
@@ -235,55 +233,32 @@ GeometryFactory::createPoint(std::unique_ptr<CoordinateSequence>&& coords) const
 std::unique_ptr<Point>
 GeometryFactory::createPoint(const CoordinateXY& coordinate) const
 {
-    if(coordinate.isNull()) {
-        return createPoint(2);
-    }
-    else {
-        return std::unique_ptr<Point>(new Point(coordinate, this));
-    }
+    return std::unique_ptr<Point>(new Point(coordinate, this));
 }
 
 /*public*/
 std::unique_ptr<Point>
 GeometryFactory::createPoint(const Coordinate& coordinate) const
 {
-    if(coordinate.isNull()) {
-        return createPoint(3);
-    }
-    else {
-        return std::unique_ptr<Point>(new Point(coordinate, this));
-    }
+    return std::unique_ptr<Point>(new Point(coordinate, this));
 }
 
 std::unique_ptr<Point>
 GeometryFactory::createPoint(const CoordinateXYM& coordinate) const
 {
-    if(coordinate.isNull()) {
-        return createPoint(4);  // can't do XYM!
-    }
-    else {
-        return std::unique_ptr<Point>(new Point(coordinate, this));
-    }
+    return std::unique_ptr<Point>(new Point(coordinate, this));
 }
 
 std::unique_ptr<Point>
 GeometryFactory::createPoint(const CoordinateXYZM& coordinate) const
 {
-    if(coordinate.isNull()) {
-        return createPoint(4);
-    }
-    else {
-        return std::unique_ptr<Point>(new Point(coordinate, this));
-    }
+    return std::unique_ptr<Point>(new Point(coordinate, this));
 }
 
 /*public*/
 std::unique_ptr<Point>
 GeometryFactory::createPoint(const CoordinateSequence& fromCoords) const
 {
-    if (fromCoords.isNullPoint()) {
-        return createPoint(fromCoords.getDimension());
-    }
     CoordinateSequence newCoords(fromCoords);
     return std::unique_ptr<Point>(new Point(std::move(newCoords), this));
 
diff --git a/tests/unit/geom/PointTest.cpp b/tests/unit/geom/PointTest.cpp
index 77245af0a..b19de45fe 100644
--- a/tests/unit/geom/PointTest.cpp
+++ b/tests/unit/geom/PointTest.cpp
@@ -597,7 +597,7 @@ void object::test<46>
     coords->add(Coordinate(geos::DoubleNotANumber, geos::DoubleNotANumber));
 
     auto point = factory_->createPoint(std::move(coords));
-    ensure("point->isEmpty()", point->isEmpty());
+    ensure("point->isEmpty()", !point->isEmpty());
     ensure("point->getCoordinateDimension() == 2", point->getCoordinateDimension() == 2);
 }
 
diff --git a/tests/unit/io/GeoJSONWriterTest.cpp b/tests/unit/io/GeoJSONWriterTest.cpp
index 4a3cf67f6..30862b168 100644
--- a/tests/unit/io/GeoJSONWriterTest.cpp
+++ b/tests/unit/io/GeoJSONWriterTest.cpp
@@ -306,5 +306,17 @@ void object::test<19>
     ensure_equals(result, "{\"type\":\"LineString\",\"coordinates\":[[0.0,0.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]}");
 }
 
+// Write a point with all-nan coordinates
+// https://github.com/libgeos/geos/issues/885
+template<>
+template<>
+void object::test<20>
+()
+{
+    GeomPtr geom(wktreader.read("POINT (NaN NaN)"));
+    std::string result = geojsonwriter.write(geom.get());
+    ensure_equals(result, "{\"type\":\"Point\",\"coordinates\":[null,null]}");
+}
+
 
 }
diff --git a/tests/unit/io/WKTReaderTest.cpp b/tests/unit/io/WKTReaderTest.cpp
index 3180a6686..b247ba844 100644
--- a/tests/unit/io/WKTReaderTest.cpp
+++ b/tests/unit/io/WKTReaderTest.cpp
@@ -447,4 +447,20 @@ void object::test<22>
     ensure_dimension("MULTIPOINT ZM ((0 0 4 3), (1 2 4 5))", true, true);
 }
 
+// accept NaN coordinates
+template<>
+template<>
+void object::test<23>
+()
+{
+    GeomPtr geom(wktreader.read("POINT(NaN NaN)"));
+    auto coords = geom->getCoordinates();
+
+    ensure(!coords->isEmpty());
+    ensure(coords->getDimension() == 2);
+    ensure(std::isnan(coords->getX(0)));
+    ensure(std::isnan(coords->getY(0)));
+}
+
+
 } // namespace tut
diff --git a/tests/unit/io/WKTWriterTest.cpp b/tests/unit/io/WKTWriterTest.cpp
index c22853be2..2292275ec 100644
--- a/tests/unit/io/WKTWriterTest.cpp
+++ b/tests/unit/io/WKTWriterTest.cpp
@@ -223,7 +223,7 @@ void object::test<7>
     auto point = factory_->createPoint(std::move(coords));
 
     std::string result = wktwriter.write(point.get());
-    ensure_equals(result, std::string("POINT EMPTY"));
+    ensure_equals(result, std::string("POINT (NaN NaN)"));
 }
 
 
@@ -406,4 +406,3 @@ void object::test<14>
 }
 
 } // namespace tut
-

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

Summary of changes:
 CMakeLists.txt                         | 32 +++++++++++++++-----------------
 HOWTO_RELEASE                          |  2 +-
 NEWS.md                                |  2 ++
 capi/geos_ts_c.cpp                     |  2 +-
 include/geos/geom/CoordinateSequence.h | 14 --------------
 src/geom/GeometryFactory.cpp           | 33 ++++-----------------------------
 tests/unit/geom/PointTest.cpp          |  2 +-
 tests/unit/io/GeoJSONWriterTest.cpp    | 12 ++++++++++++
 tests/unit/io/WKTReaderTest.cpp        | 16 ++++++++++++++++
 tests/unit/io/WKTWriterTest.cpp        |  3 +--
 10 files changed, 53 insertions(+), 65 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list