PostGIS  2.5.7dev-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 1040 of file mvt.c.

1041 {
1042  LWGEOM *ng = lwgeom;
1043 
1044  if (clip_geom)
1045  {
1046  GBOX bgbox;
1047  gbox_init(&bgbox);
1048  bgbox.xmax = bgbox.ymax = (double)extent + (double)buffer;
1049  bgbox.xmin = bgbox.ymin = -(double)buffer;
1050  FLAGS_SET_GEODETIC(bgbox.flags, 0);
1051 
1052  ng = mvt_iterate_clip_by_box_geos(lwgeom, &bgbox, basic_type);
1053  if (!ng || lwgeom_is_empty(ng))
1054  {
1055  POSTGIS_DEBUG(3, "mvt_geom: no geometry after clip");
1056  return NULL;
1057  }
1058  }
1059 
1060  ng = mvt_grid_and_validate_geos(ng, basic_type);
1061 
1062  /* Make sure we return the expected type */
1063  if (!ng || basic_type != lwgeom_get_basic_type(ng))
1064  {
1065  /* Drop type changes to play nice with MVT renderers */
1066  POSTGIS_DEBUG(1, "mvt_geom: Dropping geometry after type change");
1067  return NULL;
1068  }
1069 
1070  return ng;
1071 }
void gbox_init(GBOX *gbox)
Zero out all the entries in the GBOX.
Definition: g_box.c:47
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
Definition: lwgeom.c:1393
#define FLAGS_SET_GEODETIC(flags, value)
Definition: liblwgeom.h:149
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:910
static uint8 lwgeom_get_basic_type(LWGEOM *geom)
Definition: mvt.c:734
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:968
Datum buffer(PG_FUNCTION_ARGS)
double ymax
Definition: liblwgeom.h:298
double xmax
Definition: liblwgeom.h:296
double ymin
Definition: liblwgeom.h:297
double xmin
Definition: liblwgeom.h:295
uint8_t flags
Definition: liblwgeom.h:294

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_geom().

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