OGCGeometry#convexHull returns incorrect results for points on a single line
See original GitHub issueI’m seeing convexHull
method returning incorrect results for some inputs:
- fails if input geometry is empty, but I expect to get empty geometry back
- returns empty geometry if input is a single point, but I expect to get the original point back
- returns corrupt geometry if all points are on the same line, but I expect to get a LINESTRING geometry back
- fails if input is a geometry collection where some of the geometries are empty
For MULTIPOINT (1 1, 2 2)
input, the output is corrupt:
com.esri.core.geometry.GeometryException: corrupted geometry
at com.esri.core.geometry.OperatorExportToWktLocal.exportPolygonToWkt(OperatorExportToWktLocal.java:111)
at com.esri.core.geometry.OperatorExportToWktLocal.exportToWkt(OperatorExportToWktLocal.java:47)
at com.esri.core.geometry.OperatorExportToWktLocal.execute(OperatorExportToWktLocal.java:31)
at com.esri.core.geometry.GeometryEngine.geometryToWkt(GeometryEngine.java:274)
at com.esri.core.geometry.ogc.OGCMultiPolygon.asText(OGCMultiPolygon.java:53)
Here is the error for empty geometry.
com.esri.core.geometry.GeometryException: This operation should not be performed on an empty geometry.
at com.esri.core.geometry.Point.getXY(Point.java:102)
at com.esri.core.geometry.ConvexHull.addPoint_(ConvexHull.java:375)
at com.esri.core.geometry.ConvexHull.addGeometry(ConvexHull.java:68)
at com.esri.core.geometry.OperatorConvexHullCursor.calculateConvexHullMerging_(OperatorConvexHullCursor.java:79)
at com.esri.core.geometry.OperatorConvexHullCursor.next(OperatorConvexHullCursor.java:49)
at com.esri.core.geometry.ogc.OGCGeometry.createFromEsriCursor(OGCGeometry.java:512)
at com.esri.core.geometry.ogc.OGCGeometry.createFromEsriCursor(OGCGeometry.java:505)
at com.esri.core.geometry.ogc.OGCGeometry.convexHull(OGCGeometry.java:448)
CC: @tpeng-fb
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
21 Spatial Aggregate Functions - Oracle Help Center
The following example returns the convex hull of the geometry objects in the COLA_MARKETS table. (The example uses the definitions and data from...
Read more >geometryEngine | ArcGIS API for JavaScript 4.25
Calculates the convex hull of one or more geometries. A convex hull is the smallest convex polygon that encloses a group of geometries...
Read more >Why is my convex hull algorithm returning the wrong points?
I'm writing some Python for Autodesk Maya that should return the 2D convex hull for a given 3D polygon.
Read more >Class Geometry | NetTopologySuite - NTS Topology Suite
The buffer operation always returns a polygonal result. The negative or zero-distance buffer of lines and points is always an empty IPolygonal. This...
Read more >Release Notes - 1.72.0 - Boost C++ Libraries
557 Invalid result of distance between point and linestring in spherical-equatorial ... 596 boost::geometry::buffer generates (multi)polygon with spike.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Need to merge the branch for this before releasing. Also, rather than a 2.1.1 I’d release 2.2.0 with Centroid and this one.
@mbasmanova Yes, sure. Do you have more bugs to find 😃? @randallwhitman Would need to do a minor release.