PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ mvt_clip_and_validate_geos()

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

Definition at line 1057 of file mvt.c.

1058 {
1059  LWGEOM *ng = lwgeom;
1060 
1061  if (clip_geom)
1062  {
1063  GBOX bgbox;
1064  gbox_init(&bgbox);
1065  bgbox.xmax = bgbox.ymax = (double)extent + (double)buffer;
1066  bgbox.xmin = bgbox.ymin = -(double)buffer;
1067  FLAGS_SET_GEODETIC(bgbox.flags, 0);
1068 
1069  ng = mvt_iterate_clip_by_box_geos(lwgeom, &bgbox, basic_type);
1070  if (!ng || lwgeom_is_empty(ng))
1071  {
1072  POSTGIS_DEBUG(3, "mvt_geom: no geometry after clip");
1073  return NULL;
1074  }
1075  }
1076 
1077  ng = mvt_grid_and_validate_geos(ng, basic_type);
1078 
1079  /* Make sure we return the expected type */
1080  if (!ng || basic_type != lwgeom_get_basic_type(ng))
1081  {
1082  /* Drop type changes to play nice with MVT renderers */
1083  POSTGIS_DEBUG(1, "mvt_geom: Dropping geometry after type change");
1084  return NULL;
1085  }
1086 
1087  return ng;
1088 }
void gbox_init(GBOX *gbox)
Zero out all the entries in the GBOX.
Definition: gbox.c:40
#define FLAGS_SET_GEODETIC(flags, value)
Definition: liblwgeom.h:189
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
Definition: lwinline.h:203
static LWGEOM * mvt_iterate_clip_by_box_geos(LWGEOM *lwgeom, GBOX *clip_gbox, uint8_t basic_type)
Clips the geometry using GEOSIntersection in a "safe way", cleaning the input if necessary and clippi...
Definition: mvt.c:926
static uint8_t lwgeom_get_basic_type(LWGEOM *geom)
Definition: mvt.c:747
static LWGEOM * mvt_grid_and_validate_geos(LWGEOM *ng, uint8_t basic_type)
Given a geometry, it uses GEOS operations to make sure that it's valid according to the MVT spec and ...
Definition: mvt.c:984
Datum buffer(PG_FUNCTION_ARGS)
double ymax
Definition: liblwgeom.h:371
double xmax
Definition: liblwgeom.h:369
double ymin
Definition: liblwgeom.h:370
double xmin
Definition: liblwgeom.h:368
lwflags_t flags
Definition: liblwgeom.h:367

References buffer(), GBOX::flags, FLAGS_SET_GEODETIC, gbox_init(), lwgeom_get_basic_type(), lwgeom_is_empty(), mvt_grid_and_validate_geos(), mvt_iterate_clip_by_box_geos(), GBOX::xmax, GBOX::xmin, GBOX::ymax, and GBOX::ymin.

Referenced by mvt_clip_and_validate().

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