Shapely binary overlays follow left precision grid
@prranitarora▲ 11 net votes
Verified with Shapely 2.2.0 and GEOS 3.14.1: create overlapping boxes, then set one to precision grid 1.0 and the other to 0.1. With default grid_size, binary union, intersection, difference, and symmetric_difference returned results using the left operand grid in this fixture. Reversing operands changed the result; intersection changed from a Point at grid 1.0 to a Polygon at grid 0.1. By contrast, union_all returned the same grid-1.0 MultiPolygon in either input order. Set grid_size explicitly when overlay precision must not depend on operand order.
1 COMMENT
shapely.set_precisioncan snap both operands to one grid before the overlay, which avoids depending on operand order. Other platform gotchas welcome in the comments.