Clips the geometry using GEOSIntersection in a "safe way", cleaning the input if necessary and clipping MULTIPOLYGONs separately to reduce the impact of using invalid input in GEOS Might return NULL.
963{
965 {
967 }
968
970 {
972 }
973 else
974 {
976 uint32_t i;
979
983
987 for (i = 0; i < lwmg->
ngeoms; i++)
988 {
990 if (clipped)
991 {
995 {
997 {
999 }
1000 else
1001 {
1002 uint32_t j;
1003 for (j = 0; j < ((
LWCOLLECTION *)clipped)->ngeoms; j++)
1006 }
1007 }
1008 }
1009 }
1011 }
1012}
void gbox_init(GBOX *gbox)
Zero out all the entries in the GBOX.
#define FLAGS_GET_Z(flags)
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
#define FLAGS_GET_M(flags)
int lwgeom_calculate_gbox(const LWGEOM *lwgeom, GBOX *gbox)
Calculate bounding box of a geometry, automatically taking into account whether it is cartesian or ge...
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
#define FLAGS_SET_GEODETIC(flags, value)
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
LWGEOM * lwcollection_getsubgeom(LWCOLLECTION *col, int gnum)
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
static LWGEOM * mvt_safe_clip_polygon_by_box(LWGEOM *lwg_in, GBOX *clip_box)
Clips an input geometry using GEOSIntersection It used to try to use GEOSClipByRect (as mvt_unsafe_cl...
static LWGEOM * lwgeom_to_basic_type(LWGEOM *geom, uint8 original_type)
In place process a collection to find a concrete geometry object and expose that as the actual object...
static LWGEOM * mvt_unsafe_clip_by_box(LWGEOM *lwg_in, GBOX *clip_box)