PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ mvt_clip_and_validate()

static LWGEOM * mvt_clip_and_validate ( LWGEOM lwgeom,
uint8_t  basic_type,
uint32_t  extent,
uint32_t  buffer,
bool  clip_geom 
)
static

Definition at line 895 of file mvt.c.

896{
897 GBOX clip_box = {0};
898 LWGEOM *clipped_lwgeom;
899
900 /* Wagyu only supports polygons. Default to geos for other types */
901 lwgeom = lwgeom_to_basic_type(lwgeom, POLYGONTYPE);
902 if (lwgeom->type != POLYGONTYPE && lwgeom->type != MULTIPOLYGONTYPE)
903 {
904 return mvt_clip_and_validate_geos(lwgeom, basic_type, extent, buffer, clip_geom);
905 }
906
907 if (!clip_geom)
908 {
909 /* With clipping disabled, we request a clip with the geometry bbox to force validation */
910 lwgeom_calculate_gbox(lwgeom, &clip_box);
911 }
912 else
913 {
914 clip_box.xmax = clip_box.ymax = (double)extent + (double)buffer;
915 clip_box.xmin = clip_box.ymin = -(double)buffer;
916 }
917
918 clipped_lwgeom = lwgeom_wagyu_clip_by_box(lwgeom, &clip_box);
919
920 return clipped_lwgeom;
921}
#define MULTIPOLYGONTYPE
Definition liblwgeom.h:107
#define POLYGONTYPE
Definition liblwgeom.h:104
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...
Definition lwgeom.c:783
static LWGEOM * mvt_clip_and_validate_geos(LWGEOM *lwgeom, uint8_t basic_type, uint32_t extent, uint32_t buffer, bool clip_geom)
Definition mvt.c:871
static LWGEOM * lwgeom_to_basic_type(LWGEOM *geom, uint8_t original_type)
In place process a collection to find a concrete geometry object and expose that as the actual object...
Definition mvt.c:814
Datum buffer(PG_FUNCTION_ARGS)
double ymax
Definition liblwgeom.h:357
double xmax
Definition liblwgeom.h:355
double ymin
Definition liblwgeom.h:356
double xmin
Definition liblwgeom.h:354
uint8_t type
Definition liblwgeom.h:462

References buffer(), lwgeom_calculate_gbox(), lwgeom_to_basic_type(), MULTIPOLYGONTYPE, mvt_clip_and_validate_geos(), POLYGONTYPE, LWGEOM::type, GBOX::xmax, GBOX::xmin, GBOX::ymax, and GBOX::ymin.

Referenced by mvt_geom().

Here is the call graph for this function:
Here is the caller graph for this function: