question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

buffer on small polygons is returning null

See original GitHub issue

Buffering very small polygons (which a user obtained by buffering a Point by a small amount) returns null. For example,

    OGCGeometry p = OGCGeometry.fromText(
        "POLYGON ((177.0 64.0, 177.0000000001 64.0, 177.0000000001 64.0000000001, 177.0 64.0000000001, 177.0 64.0))"
    );
    OGCGeometry buffered = p.buffer(0.01);
    assertIsNull(buffered);

During the simplification step, the CrackAndCluster._do() collapses nearby points, which includes these nearby vertices. Instead of collapsing it to a Point, it collapses it to a Polygon with no rings, which eventually bubbles up as a null.

This, of course, causes an NPE when used.

cc @mbasmanova

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
stolstovcommented, Aug 7, 2019

@jagill Buffer expects topologically simple input and should produce a topologicaly simple output. When a point is buffered with 1e-9 distance, the result polygon is smaller than the tolerance, thus it is considered non-simple, and is deleted.

0reactions
jagillcommented, Sep 2, 2019

Verified fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

#176 (Buffer returns empty geometry though it should not be ...
I created a small python script that returns an EMPTY polygon when called with a geos lib compiled without debug. Called with a...
Read more >
shapely object.buffer(0) return a empty polygon(coordinates ...
Most of the polygons have been processed properly,but there are still few polygons returned empty,which coordinates are empty array. The result ...
Read more >
Dissolve causes 'No Shapely geometry can be created from ...
the Error says that your polygons do have a self intersection at the given coordinates, to avoid it you will have to reconstruct...
Read more >
ST_Buffer - PostGIS
Computes a POLYGON or MULTIPOLYGON that represents all points whose distance from a geometry/geography is less than or equal to a given distance....
Read more >
SDO_GEOM.SDO_BUFFER
This function returns a geometry object representing the buffer polygon. ... this function should be used only for relatively small geometries: geometries ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found