[geos-devel] 3.9.0beta1 + GEOSwift

Paul Ramsey pramsey at cleverelephant.ca
Sun Nov 29 09:37:59 PST 2020


Looking at PrecisionReducer::reducePrecision, it seems like it should perhaps have a little extra logic so that each dimension of the input are handled separately. Underlying the op is just 

  OverlayNG ov(geom, nullptr, gf.get(), OverlayNG::UNION);

So doing that a dimension at a time for any heterogeneous collection makes sense, IMO.
P.


> On Nov 28, 2020, at 6:33 PM, Andrew Hershberger <andrew.d.hershberger at gmail.com> wrote:
> 
> Hi al
> 
> 2) GeometryConvertible_GEOSTests.testBufferAllTypes()
> 
> This test is intended to be a sort of stress-test to make sure that all the types of geometry on which GEOSwift allows you to invoke buffer(by:) (wrapper around the CAPI's GEOSBuffer_r) can actually be buffered. In geos 3.8.1, all the sample geometries were able to be buffered without any issues.
> 
> Here's what we get for one of the test cases with 3.9.0beta1:
> 
> Input:
> 
> GeometryCollection(
>   geometries: [
>     GeometryCollection(
>       geometries: [
>         Point(x: 1.0, y: 2.0),
>         MultiPoint(
>           points: [
>             Point(x: 1.0, y: 2.0),
>             Point(x: 3.0, y: 4.0)
>           ]
>         ),
>         LineString(
>           points: [
>             Point(x: 1.0, y: 2.0),
>             Point(x: 3.0, y: 4.0)
>           ]
>         ),
>         MultiLineString(
>           lineStrings: [
>             LineString(
>               points: [
>                 Point(x: 1.0, y: 2.0),
>                 Point(x: 3.0, y: 4.0)
>               ]
>             ),
>             LineString(
>               points: [
>                 Point(x: 5.0, y: 6.0),
>                 Point(x: 7.0, y: 8.0)
>               ]
>             )
>           ]
>         ),
>         Polygon(
>           exterior: LinearRing(
>             points: [
>               Point(x: 2.0, y: 2.0),
>               Point(x: -2.0, y: 2.0),
>               Point(x: -2.0, y: -2.0),
>               Point(x: 2.0, y: -2.0),
>               Point(x: 2.0, y: 2.0)
>             ]
>           ),
>           holes: [
>             LinearRing(
>               points: [
>                 Point(x: 1.0, y: 1.0),
>                 Point(x: 1.0, y: -1.0),
>                 Point(x: -1.0, y: -1.0),
>                 Point(x: -1.0, y: 1.0),
>                 Point(x: 1.0, y: 1.0)
>               ]
>             )
>           ]
>         ),
>         MultiPolygon(
>           polygons: [
>             Polygon(
>               exterior: LinearRing(
>                 points: [
>                   Point(x: 2.0, y: 2.0),
>                   Point(x: -2.0, y: 2.0),
>                   Point(x: -2.0, y: -2.0),
>                   Point(x: 2.0, y: -2.0),
>                   Point(x: 2.0, y: 2.0)
>                 ]
>               ),
>               holes: [
>                 LinearRing(
>                   points: [
>                     Point(x: 1.0, y: 1.0),
>                     Point(x: 1.0, y: -1.0),
>                     Point(x: -1.0, y: -1.0),
>                     Point(x: -1.0, y: 1.0),
>                     Point(x: 1.0, y: 1.0)
>                   ]
>                 )
>               ]
>             ),
>             Polygon(
>               exterior: LinearRing(
>                 points: [
>                   Point(x: 7.0, y: 2.0),
>                   Point(x: 3.0, y: 2.0),
>                   Point(x: 3.0, y: -2.0),
>                   Point(x: 7.0, y: -2.0),
>                   Point(x: 7.0, y: 2.0)
>                 ]
>               ),
>               holes: []
>             )
>           ]
>         )
>       ]
>     )
>   ]
> )
> 
> buffer(by: 0.5)
> 
> errorMessage: "IllegalArgumentException: Overlay input is mixed-dimension"
> 
> The exception is being thrown from EdgeNodingBuilder.cpp:195.
> 
> In frame #2, i = 0
> 
> In frame #0, i = 0
> 
> This suggests to me that it's checking the dimension of the Point inside of the child GeometryCollection inside of the parent GeometryCollection.
> 
> g->getDimension() is returning 0 (geos::geom::Dimension::DimensionType P) and expectedDim is 2.
> 
> Here's a relevant stack trace:
> 
> #0 geos::operation::overlayng::EdgeNodingBuilder::addGeometryCollection(geos::geom::GeometryCollection const*, int, int) at geos/src/operation/overlayng/EdgeNodingBuilder.cpp:195
> #1 geos::operation::overlayng::EdgeNodingBuilder::add(geos::geom::Geometry const*, int) at geos/src/operation/overlayng/EdgeNodingBuilder.cpp:169
> #2 geos::operation::overlayng::EdgeNodingBuilder::addGeometryCollection(geos::geom::GeometryCollection const*, int, int) at geos/src/operation/overlayng/EdgeNodingBuilder.cpp:197
> #3 geos::operation::overlayng::EdgeNodingBuilder::add(geos::geom::Geometry const*, int) at geos/src/operation/overlayng/EdgeNodingBuilder.cpp:169
> #4 geos::operation::overlayng::EdgeNodingBuilder::build(geos::geom::Geometry const*, geos::geom::Geometry const*) at geos/src/operation/overlayng/EdgeNodingBuilder.cpp:82
> #5 geos::operation::overlayng::OverlayNG::computeEdgeOverlay() at geos/src/operation/overlayng/OverlayNG.cpp:222
> #6 geos::operation::overlayng::OverlayNG::getResult() at geos/src/operation/overlayng/OverlayNG.cpp:179
> #7 geos::operation::overlayng::PrecisionReducer::reducePrecision(geos::geom::Geometry const*, geos::geom::PrecisionModel const*, bool) at geos/src/operation/overlayng/PrecisionReducer.cpp:46
> #8 geos::precision::GeometryPrecisionReducer::reduce(geos::geom::Geometry const&) at geos/src/precision/GeometryPrecisionReducer.cpp:60
> #9 geos::precision::GeometryPrecisionReducer::reduce(geos::geom::Geometry const&, geos::geom::PrecisionModel const&) at geos/include/geos/precision/GeometryPrecisionReducer.h:102
> #10 geos::operation::buffer::BufferOp::bufferFixedPrecision(geos::geom::PrecisionModel const&) at geos/src/operation/buffer/BufferOp.cpp:263
> #11 geos::operation::buffer::BufferOp::bufferReducedPrecision(int) at geos/src/operation/buffer/BufferOp.cpp:218
> #12 geos::operation::buffer::BufferOp::bufferReducedPrecision() at geos/src/operation/buffer/BufferOp.cpp:168
> #13 geos::operation::buffer::BufferOp::computeGeometry() at geos/src/operation/buffer/BufferOp.cpp:150
> #14 geos::operation::buffer::BufferOp::getResultGeometry(double) at geos/src/operation/buffer/BufferOp.cpp:122
> #15 geos::operation::buffer::BufferOp::bufferOp(geos::geom::Geometry const*, double, int, int) at geos/src/operation/buffer/BufferOp.cpp:114
> #16 geos::geom::Geometry::buffer(double, int) const at geos/src/geom/Geometry.cpp:509
> #17 GEOSBuffer_r::$_41::operator()() const at geos/capi/geos_ts_c.cpp:1078
> #18 _Z7executeIZ12GEOSBuffer_rE4$_41LDn0EEDTclfp0_EEP20GEOSContextHandle_HSOT_ at geos/capi/geos_ts_c.cpp:388
> #19 ::GEOSBuffer_r(GEOSContextHandle_t, const geos::geom::Geometry *, double, int) at geos/capi/geos_ts_c.cpp:1077
> #20 GeometryConvertible.buffer(by:) at GEOSwift/GEOSwift/GEOS/GeometryConvertible+GEOS.swift:348
> #21 GeometryConvertible_GEOSTests.testBufferAllTypes() at GEOSwift/GEOSwiftTests/GEOS/GeometryConvertible+GEOSTests.swift:856
> 
> Let me know what other info I can provide.
> 
> --
> Andrew
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/geos-devel



More information about the geos-devel mailing list