[geos-commits] [SCM] GEOS branch main updated. 90e50bbf990258dee3914482bc709211153a9035

git at osgeo.org git at osgeo.org
Wed Nov 3 10:07:34 PDT 2021


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  90e50bbf990258dee3914482bc709211153a9035 (commit)
       via  f84feeb4c20f968294776e8afa832813161a13a5 (commit)
       via  a51060c15ac2d8813e60de33bbc0ce0d07cc0d3b (commit)
      from  56a1ecf54ca9eb2c3f56538da3d8d9c00be3eaf4 (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 90e50bbf990258dee3914482bc709211153a9035
Merge: f84feeb4c 56a1ecf54
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Wed Nov 3 10:07:30 2021 -0700

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


commit f84feeb4c20f968294776e8afa832813161a13a5
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Wed Nov 3 10:07:23 2021 -0700

    Fix over-eager cpack rule skipping package components.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index fe5e576c9..a6029d9f6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -427,9 +427,10 @@ if(NOT _is_multi_config_generator)
     "/debian/"
     "/php/"
     "/.*build-.*/"
-    "cmake_install\\\\.cmake"
-    "/include/geos/version\\\\.h"
-    "/tools/geos-config"
+    "cmake_install\\\\.cmake\$"
+    "/include/geos/version\\\\.h\$"
+    "/tools/geos-config\$"
+    "/tools/geos\\\\.pc\$"
     "/bin/"
     ${PROJECT_BINARY_DIR}
     )

commit a51060c15ac2d8813e60de33bbc0ce0d07cc0d3b
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Wed Nov 3 08:27:50 2021 -0700

    Fix crash in GeoJSONWriter in the case of empty points. Add some tests around empty geometries in general. References #1139

diff --git a/src/dirlist.mk b/src/dirlist.mk
deleted file mode 100644
index 15f2a11ff..000000000
--- a/src/dirlist.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# List of directories use by makefile.vc to clean .obj files
-#
-
-GEOS_DIRLIST =  \
-	algorithm \
-	algorithm\distance \
-	algorithm\locate \
-	examples \
-	geom \
-	geom\util \
-	geom\prep \
-	geomgraph \
-	geomgraph\index \
-	headers \
-	headers\geos \
-	index \
-	index\bintree \
-	index\chain \
-	index\intervalrtree \
-	index\quadtree \
-	index\strtree \
-	index\sweepline \
-	io \
-	linearref \
-	noding \
-	noding\snapround \
-	operation \
-	operation\buffer \
-	operation\distance \
-	operation\intersection \
-	operation\linemerge \
-	operation\overlay \
-	operation\overlay\snap \
-	operation\overlay\validate \
-	operation\polygonize \
-	operation\predicate \
-	operation\relate \
-	operation\sharedpaths \
-	operation\union \
-	operation\valid \
-	planargraph \
-	planargraph\algorithm \
-	precision \
-	simplify \
-	triangulate \
-	triangulate\quadedge \
-	util
diff --git a/src/io/GeoJSONWriter.cpp b/src/io/GeoJSONWriter.cpp
index c8bbab50d..464f26b7c 100644
--- a/src/io/GeoJSONWriter.cpp
+++ b/src/io/GeoJSONWriter.cpp
@@ -205,7 +205,12 @@ void GeoJSONWriter::encodeGeometry(const geom::Geometry* geometry, geos_nlohmann
 void GeoJSONWriter::encodePoint(const geom::Point* point, geos_nlohmann::ordered_json& j)
 {
     j["type"] = "Point";
-    j["coordinates"] = convertCoordinate(point->getCoordinate());
+    if (!point->isEmpty()) {
+        j["coordinates"] = convertCoordinate(point->getCoordinate());
+    }
+    else {
+        j["coordinates"] = j.array();
+    }
 }
 
 void GeoJSONWriter::encodeLineString(const geom::LineString* line, geos_nlohmann::ordered_json& j)
diff --git a/tests/unit/io/GeoJSONWriterTest.cpp b/tests/unit/io/GeoJSONWriterTest.cpp
index 6faab6ecb..201db101b 100644
--- a/tests/unit/io/GeoJSONWriterTest.cpp
+++ b/tests/unit/io/GeoJSONWriterTest.cpp
@@ -252,4 +252,47 @@ void object::test<14>
     ensure_equals(result, "{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"geometry\":{\"type\":\"Point\",\"coordinates\":[-117.0,33.0]},\"properties\":{\"id\":1.0,\"name\":\"One\"}},{\"type\":\"Feature\",\"geometry\":{\"type\":\"Point\",\"coordinates\":[-127.0,53.0]},\"properties\":{\"id\":2.0,\"name\":\"Two\"}}]}");
 }
 
+// Write an empty point
+template<>
+template<>
+void object::test<15>
+()
+{
+    GeomPtr geom(wktreader.read("POINT EMPTY"));
+    std::string result = geojsonwriter.write(geom.get());
+    ensure_equals(result, "{\"type\":\"Point\",\"coordinates\":[]}");
+}
+
+// Write an empty linestring
+template<>
+template<>
+void object::test<16>
+()
+{
+    GeomPtr geom(wktreader.read("LINESTRING EMPTY"));
+    std::string result = geojsonwriter.write(geom.get());
+    ensure_equals(result, "{\"type\":\"LineString\",\"coordinates\":[]}");
+}
+
+// Write an empty polygon
+template<>
+template<>
+void object::test<17>
+()
+{
+    GeomPtr geom(wktreader.read("POLYGON EMPTY"));
+    std::string result = geojsonwriter.write(geom.get());
+    ensure_equals(result, "{\"type\":\"Polygon\",\"coordinates\":[[]]}");
+}
+
+// Write an empty polygon
+template<>
+template<>
+void object::test<18>
+()
+{
+    GeomPtr geom(wktreader.read("GEOMETRYCOLLECTION EMPTY"));
+    std::string result = geojsonwriter.write(geom.get());
+    ensure_equals(result, "{\"type\":\"GeometryCollection\",\"geometries\":[]}");
+}
 }

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

Summary of changes:
 CMakeLists.txt                      |  7 +++---
 src/dirlist.mk                      | 48 -------------------------------------
 src/io/GeoJSONWriter.cpp            |  7 +++++-
 tests/unit/io/GeoJSONWriterTest.cpp | 43 +++++++++++++++++++++++++++++++++
 4 files changed, 53 insertions(+), 52 deletions(-)
 delete mode 100644 src/dirlist.mk


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list