[geos-commits] [SCM] GEOS branch main updated. 59d9f5073e49db96ab93ddddbcfb4de67c151e48
git at osgeo.org
git at osgeo.org
Thu May 11 08:47:15 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 59d9f5073e49db96ab93ddddbcfb4de67c151e48 (commit)
via 091f6d99fd2d6485c8f1be1106f914c4bb4c2b84 (commit)
from 12321f7276512ec722bc95ad51e2a8e01acc9ea1 (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 59d9f5073e49db96ab93ddddbcfb4de67c151e48
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Thu May 11 08:46:46 2023 -0700
remove EOLed versions from download list
diff --git a/web/content/usage/download.md b/web/content/usage/download.md
index 29f35a7f3..83d264711 100644
--- a/web/content/usage/download.md
+++ b/web/content/usage/download.md
@@ -14,16 +14,9 @@ draft: false
| **3.9.4** | 2022/11/14 | 2020/12/09 | *2024/12/09* | [geos-3.9.4.tar.bz2](https://download.osgeo.org/geos/geos-3.9.4.tar.bz2) | [Changes](https://github.com/libgeos/geos/blob/3.9.4/NEWS) |
| **3.8.3** | 2022/06/02 | 2019/10/10 | *2023/10/10* | [geos-3.8.3.tar.bz2](https://download.osgeo.org/geos/geos-3.8.3.tar.bz2) | [Changes](https://github.com/libgeos/geos/blob/3.8.3/NEWS) |
| **3.7.5** | 2022/06/08 | 2018/09/10 | *2023/03/31* | [geos-3.7.5.tar.bz2](https://download.osgeo.org/geos/geos-3.7.5.tar.bz2) | [Changes](https://github.com/libgeos/geos/blob/3.7.5/NEWS) |
-| **3.6.6** EOL | 2023/01/27 | 2016/10/25 | 2023/01/27 | [geos-3.6.6.tar.bz2](https://download.osgeo.org/geos/geos-3.6.6.tar.bz2) | [Changes](https://github.com/libgeos/geos/blob/3.6.6/NEWS) |
-| **3.5.2** EOL | 2019/10/04 | 2015/08/16 | 2019/10/04| [geos-3.5.2.tar.bz2](https://download.osgeo.org/geos/geos-3.5.2.tar.bz2) | [Changes](https://github.com/libgeos/geos/blob/3.5.2/NEWS) |
-If you see **EOL** next to a released version, it means no security or patch updates will be added to that minor and you should upgrade to a higher release.
-Refer to our [End-Of-Life (EOL) Policy](/project/rfcs/rfc11/) for details.
-Older releases prior to the ones listed above, are all EOL'd.
+Old releases can be downloaded from https://download.osgeo.org/geos/. Any releases not in this list are end-of-life (EOL). Refer to our [EOL policy](/project/rfcs/rfc11/) for details. All *Final Release* dates are subject to change.
-Old releases can be downloaded from https://download.osgeo.org/geos/.
-
-All *future* **Final Release** dates are subject to change.
## Build From Source
commit 091f6d99fd2d6485c8f1be1106f914c4bb4c2b84
Author: Sandro Santilli <strk at kbt.io>
Date: Mon May 8 11:50:04 2023 +0200
Only keep biggest polygon from single-sided buffer
Closes GH-665
Closes #810
Closes #712
Includes unit test
diff --git a/NEWS.md b/NEWS.md
index 14714aee3..82ac7c79d 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -65,6 +65,7 @@ xxxx-xx-xx
- Fix MaximumInscribedCircle and LargestEmptyCircle performance and memory issues (GH-883, Martin Davis)
- GEOSHasZ: Fix handling with empty geometries (GH-887, Mike Taves)
- OffsetCurve: fix EndCap parameter handling (GH-899, Martin Davis)
+ - Reduce artifacts in single-sided Buffers: (GH-665 #810 and #712, Sandro Santilli)
- Changes:
- Remove Orientation.isCCW exception to simplify logic and align with JTS (GH-878, Martin Davis)
diff --git a/src/operation/buffer/BufferBuilder.cpp b/src/operation/buffer/BufferBuilder.cpp
index 500d729e2..8ebe484ff 100644
--- a/src/operation/buffer/BufferBuilder.cpp
+++ b/src/operation/buffer/BufferBuilder.cpp
@@ -35,6 +35,7 @@
#include <geos/operation/overlay/snap/SnapOverlayOp.h>
#include <geos/operation/overlay/PolygonBuilder.h>
#include <geos/operation/overlay/OverlayNodeFactory.h>
+#include <geos/operation/polygonize/Polygonizer.h>
#include <geos/operation/valid/RepeatedPointRemover.h>
#include <geos/operation/linemerge/LineMerger.h>
#include <geos/algorithm/LineIntersector.h>
@@ -478,6 +479,73 @@ BufferBuilder::buffer(const Geometry* g, double distance)
throw;
}
+ // Cleanup single-sided buffer artifacts, if needed
+ if ( bufParams.isSingleSided() )
+ {
+
+ // Get linework of input geom
+ const Geometry *inputLineString = g;
+ std::unique_ptr<Geometry> inputPolygonBoundary;
+ if ( g->getDimension() > 1 )
+ {
+ inputPolygonBoundary = g->getBoundary();
+ inputLineString = inputPolygonBoundary.get();
+ }
+
+#if GEOS_DEBUG
+ std::cerr << "Input linework: " << *inputLineString << std::endl;
+#endif
+
+ // Get linework of buffer geom
+ std::unique_ptr<Geometry> bufferBoundary = resultGeom->getBoundary();
+
+#if GEOS_DEBUG
+ std::cerr << "Buffer boundary: " << *bufferBoundary << std::endl;
+#endif
+
+ // Node all linework
+ using operation::overlayng::OverlayNG;
+ std::unique_ptr<Geometry> nodedLinework = OverlayNG::overlay(inputLineString, bufferBoundary.get(), OverlayNG::UNION);
+
+#if GEOS_DEBUG
+ std::cerr << "Noded linework: " << *nodedLinework << std::endl;
+#endif
+
+ using operation::polygonize::Polygonizer;
+ Polygonizer plgnzr;
+ plgnzr.add(nodedLinework.get());
+ std::vector<std::unique_ptr<geom::Polygon>> polys = plgnzr.getPolygons();
+
+#if GEOS_DEBUG
+ std::cerr << "Polygonization of noded linework returend: " << polys.size() << " polygons" << std::endl;
+#endif
+
+ if ( polys.size() > 1 )
+ {
+ // Only keep larger polygon
+ std::vector<std::unique_ptr<geom::Polygon>>::iterator
+ it,
+ itEnd = polys.end(),
+ biggestPolygonIterator = itEnd;
+ double maxArea = 0;
+ for ( it = polys.begin(); it != itEnd; ++it )
+ {
+ double area = (*it)->getArea();
+ if ( area > maxArea )
+ {
+ biggestPolygonIterator = it;
+ maxArea = area;
+ }
+ }
+
+ if ( biggestPolygonIterator != itEnd ) {
+ Geometry *gg = (*biggestPolygonIterator).release();
+ return std::unique_ptr<Geometry>( gg );
+ } // else there were no polygons formed...
+ }
+
+ }
+
return resultGeom;
}
diff --git a/tests/unit/operation/buffer/BufferOpTest.cpp b/tests/unit/operation/buffer/BufferOpTest.cpp
index a40e85a31..a1ff2e557 100644
--- a/tests/unit/operation/buffer/BufferOpTest.cpp
+++ b/tests/unit/operation/buffer/BufferOpTest.cpp
@@ -549,4 +549,25 @@ void object::test<20>
ensure( 0 == dynamic_cast<const geos::geom::Polygon*>(result1.get())->getNumInteriorRing() );
}
+// Test for single-sided buffer
+// See https://github.com/libgeos/geos/issues/665
+template<>
+template<>
+void object::test<21>
+()
+{
+ using geos::operation::buffer::BufferOp;
+ using geos::operation::buffer::BufferParameters;
+
+ std::string wkt("LINESTRING (50 50, 150 150, 150 100, 150 0)");
+ GeomPtr geom(wktreader.read(wkt));
+
+ geos::operation::buffer::BufferParameters bp;
+ bp.setSingleSided(true);
+ geos::operation::buffer::BufferOp op(geom.get(), bp);
+
+ std::unique_ptr<Geometry> result = op.getResultGeometry(-21);
+ ensure_equals(int(result->getArea()), 5055);
+}
+
} // namespace tut
-----------------------------------------------------------------------
Summary of changes:
NEWS.md | 1 +
src/operation/buffer/BufferBuilder.cpp | 68 ++++++++++++++++++++++++++++
tests/unit/operation/buffer/BufferOpTest.cpp | 21 +++++++++
web/content/usage/download.md | 9 +---
4 files changed, 91 insertions(+), 8 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list