Opened 6 years ago

Closed 6 years ago

#4135 closed defect (fixed)

Fix lwgeom_clip_by_rect

Reported by: dbaston Owned by: pramsey
Priority: critical Milestone: PostGIS 2.5.0
Component: postgis Version: master
Keywords: Cc:

Description

The lwgeom_clip_by_rect function was introduced in 2.4 to:

Clip a geometry by a 2D box in a fast but possibly dirty way. The output geometry is not guaranteed to be valid (self-intersections for a polygon may be introduced). Topologically invalid input geometries do not result in exceptions being thrown.

In trunk, this function has been redefined to delegate to lwgeom_intersection and is no longer consistent with the description above. This was done because of a reported bug in GEOS, but that bug report cannot be reproduced. If the GEOS bug report is invalid, then lwgeom_clip_by_rect should be reverted to its 2.4 state.

Related: #4039, #4134

Change History (2)

comment:1 by strk, 6 years ago

Delegating clip-by-rect to lwgeom_intersection defeats its purpose, which was speed & tolerance to invalid input/output

comment:2 by dbaston, 6 years ago

Resolution: fixed
Status: newclosed

In 16679:

Revert lwgeom_clip_by_rect to use GEOSClipByRect

This commit reverts lwgeom_clip_by_rect to its implementation in PostGIS 2.2 -
2.4.

It makes trivial modifications to the MVT tests to reflect the different results
returned by GEOSClipByRect instead of GEOSIntersection. The changed results are
topologically equivalent to the previous results, and their orientation is
unchanged.

No tests have been commented out or made version-dependent.

Closes #4134
Closes #4135
References #4038
Closes https://github.com/postgis/postgis/pull/282

Note: See TracTickets for help on using tickets.