Loading doc/reference_processing.xml +12 −12 Original line number Diff line number Diff line Loading @@ -490,16 +490,16 @@ FROM (SELECT ST_Buffer( <title>Description</title> <para> Clips 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. Clips a geometry by a 2D box. 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. </para> <para>Performed by the GEOS module.</para> <note><para>Requires GEOS 3.5.0+</para></note> <para>Availability: 2.2.0 - requires GEOS >= 3.5.0.</para> <para>Changed: 2.5.0 - wrapper around ST_Intersection to work around GEOS bugs. </para> </refsection> Loading liblwgeom/lwgeom_geos.c +7 −27 Original line number Diff line number Diff line Loading @@ -884,8 +884,14 @@ lwgeom_clip_by_rect(const LWGEOM *geom1, double x1, double y1, double x2, double { LWGEOM *result; LWGEOM *tmp; LWGEOM *envelope = (LWGEOM*)lwpoly_construct_envelope(geom1->srid, x1, y1, x2, y2); /* This lwgeom_intersection should be a call to GEOSClipByRect: * g3 = GEOSClipByRect(g1, x1, y1, x2, y2); * Unfortunately as of GEOS 3.7 it chokes on practical inputs. * GEOS ticket: https://trac.osgeo.org/geos/ticket/865 */ LWGEOM *envelope = (LWGEOM *)lwpoly_construct_envelope(geom1->srid, x1, y1, x2, y2); result = lwgeom_intersection(geom1, envelope); lwgeom_free(envelope); Loading @@ -908,32 +914,6 @@ lwgeom_clip_by_rect(const LWGEOM *geom1, double x1, double y1, double x2, double lwgeom_simplify_in_place(result, 0.0, LW_TRUE); return result; #if 0 /* POSTGIS_GEOS_VERSION >= 35, enable only after bugs in geos are fixed */ int32_t srid = get_result_srid(geom, NULL, __func__); uint8_t is3d = FLAGS_GET_Z(geom->flags); GEOSGeometry *g1, *g3; if (srid == SRID_INVALID) return NULL; /* A.Intersection(Empty) == Empty */ if (lwgeom_is_empty(geom)) return lwgeom_clone_deep(geom); initGEOS(lwnotice, lwgeom_geos_error); if (!input_lwgeom_to_geos(&g1, geom, __func__)) return NULL; g3 = GEOSClipByRect(g1, x1, y1, x2, y2); if (!g3) return geos_clean_and_fail(g1, NULL, NULL, __func__); if (!output_geos_as_lwgeom(&g3, &result, srid, is3d, __func__)) return geos_clean_and_fail(g1, NULL, g3, __func__); geos_clean(g1, NULL, g3); return result; #endif /* POSTGIS_GEOS_VERSION >= 35 */ } /* ------------ BuildArea stuff ---------------------------------------------------------------------{ */ Loading Loading
doc/reference_processing.xml +12 −12 Original line number Diff line number Diff line Loading @@ -490,16 +490,16 @@ FROM (SELECT ST_Buffer( <title>Description</title> <para> Clips 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. Clips a geometry by a 2D box. 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. </para> <para>Performed by the GEOS module.</para> <note><para>Requires GEOS 3.5.0+</para></note> <para>Availability: 2.2.0 - requires GEOS >= 3.5.0.</para> <para>Changed: 2.5.0 - wrapper around ST_Intersection to work around GEOS bugs. </para> </refsection> Loading
liblwgeom/lwgeom_geos.c +7 −27 Original line number Diff line number Diff line Loading @@ -884,8 +884,14 @@ lwgeom_clip_by_rect(const LWGEOM *geom1, double x1, double y1, double x2, double { LWGEOM *result; LWGEOM *tmp; LWGEOM *envelope = (LWGEOM*)lwpoly_construct_envelope(geom1->srid, x1, y1, x2, y2); /* This lwgeom_intersection should be a call to GEOSClipByRect: * g3 = GEOSClipByRect(g1, x1, y1, x2, y2); * Unfortunately as of GEOS 3.7 it chokes on practical inputs. * GEOS ticket: https://trac.osgeo.org/geos/ticket/865 */ LWGEOM *envelope = (LWGEOM *)lwpoly_construct_envelope(geom1->srid, x1, y1, x2, y2); result = lwgeom_intersection(geom1, envelope); lwgeom_free(envelope); Loading @@ -908,32 +914,6 @@ lwgeom_clip_by_rect(const LWGEOM *geom1, double x1, double y1, double x2, double lwgeom_simplify_in_place(result, 0.0, LW_TRUE); return result; #if 0 /* POSTGIS_GEOS_VERSION >= 35, enable only after bugs in geos are fixed */ int32_t srid = get_result_srid(geom, NULL, __func__); uint8_t is3d = FLAGS_GET_Z(geom->flags); GEOSGeometry *g1, *g3; if (srid == SRID_INVALID) return NULL; /* A.Intersection(Empty) == Empty */ if (lwgeom_is_empty(geom)) return lwgeom_clone_deep(geom); initGEOS(lwnotice, lwgeom_geos_error); if (!input_lwgeom_to_geos(&g1, geom, __func__)) return NULL; g3 = GEOSClipByRect(g1, x1, y1, x2, y2); if (!g3) return geos_clean_and_fail(g1, NULL, NULL, __func__); if (!output_geos_as_lwgeom(&g3, &result, srid, is3d, __func__)) return geos_clean_and_fail(g1, NULL, g3, __func__); geos_clean(g1, NULL, g3); return result; #endif /* POSTGIS_GEOS_VERSION >= 35 */ } /* ------------ BuildArea stuff ---------------------------------------------------------------------{ */ Loading