PostGIS  3.0.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 1093 of file mvt.c.

1094 {
1095  LWGEOM *ng = lwgeom;
1096 
1097  if (clip_geom)
1098  {
1099  GBOX bgbox;
1100  gbox_init(&bgbox);
1101  bgbox.xmax = bgbox.ymax = (double)extent + (double)buffer;
1102  bgbox.xmin = bgbox.ymin = -(double)buffer;
1103  FLAGS_SET_GEODETIC(bgbox.flags, 0);
1104 
1105  ng = mvt_iterate_clip_by_box_geos(lwgeom, &bgbox, basic_type);
1106  if (!ng || lwgeom_is_empty(ng))
1107  {
1108  POSTGIS_DEBUG(3, "mvt_geom: no geometry after clip");
1109  return NULL;
1110  }
1111  }
1112 
1113  ng = mvt_grid_and_validate_geos(ng, basic_type);
1114 
1115  /* Make sure we return the expected type */
1116  if (!ng || basic_type != lwgeom_get_basic_type(ng))
1117  {
1118  /* Drop type changes to play nice with MVT renderers */
1119  POSTGIS_DEBUG(1, "mvt_geom: Dropping geometry after type change");
1120  return NULL;
1121  }
1122 
1123  return ng;
1124 }
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:193
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:962
static uint8 lwgeom_get_basic_type(LWGEOM *geom)
Definition: mvt.c:783
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:1020
Datum buffer(PG_FUNCTION_ARGS)
double ymax
Definition: liblwgeom.h:343
double xmax
Definition: liblwgeom.h:341
double ymin
Definition: liblwgeom.h:342
double xmin
Definition: liblwgeom.h:340
lwflags_t flags
Definition: liblwgeom.h:339

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: