Opened 4 years ago

Last modified 4 years ago

#4688 new enhancement

Improving performance of clipping with rectangles

Reported by: postgispaul Owned by: pramsey
Priority: medium Milestone: PostGIS Fund Me
Component: postgis Version: master
Keywords: Cc:

Description

There is some improvement possible when calculating the intersection of a geometry g and a rectangle r that is completely covering the geometry g.

This can be useful f.e. if you want to clip geometries to exclude +90deg or -90deg parts so it doesn't generate errors when converting to Mercator.

If r is indeed fully covering g then the intersection is just g.

This can easily be extended to union (result is r) although usecase is unclear. A bit harder but doable are difference and symdifference.

Change History (3)

comment:1 by mdavis, 4 years ago

Perhaps this need could be met by improving ST_ClipByBox2D so that it produces valid output geometry?

comment:2 by Algunenano, 4 years ago

Milestone: PostGIS 3.1.0
Type: defectenhancement
Version: 2.5.xmaster

Perhaps this need could be met by improving ​ST_ClipByBox2D so that it produces valid output geometry?

For this use case, ST_ClipByBox2D won't execute GEOS functions unless it needs to (it has bbox shortcuts).

In any case, I do see the benefit of checking whether one of the input geometries of ST_Interects/ST_Intersection is a box to add some shortcuts (not exactly the same for both functions but still a benefit).

comment:3 by pramsey, 4 years ago

Milestone: PostGIS 3.1.0PostGIS Fund Me
Note: See TracTickets for help on using tickets.