Given a geometry, it uses GEOS operations to make sure that it's valid according to the MVT spec and that all points are snapped into int coordinates It iterates several times if needed, if it fails, returns NULL.
970 gridspec grid = {0, 0, 0, 0, 1, 1, 0, 0};
987 static const uint32_t max_iterations = 3;
997 valid = GEOSisValid(geo) == 1;
999 while (!valid && iterations < max_iterations)
1001 #if POSTGIS_GEOS_VERSION < 38
1004 GEOSGeometry *geo_valid = GEOSMakeValid(geo);
1006 GEOSGeom_destroy(geo);
1011 GEOSGeom_destroy(geo_valid);
1018 valid = GEOSisValid(geo) == 1;
1021 GEOSGeom_destroy(geo);
1025 POSTGIS_DEBUG(1,
"mvt_geom: Could not transform into a valid MVT geometry");
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *lwgeom, uint8_t autofix)
LWGEOM * GEOS2LWGEOM(const GEOSGeometry *geom, uint8_t want3d)
void lwgeom_geos_error(const char *fmt,...)
GEOSGeometry * LWGEOM_GEOS_makeValid(const GEOSGeometry *)
void lwgeom_force_clockwise(LWGEOM *lwgeom)
Force Right-hand-rule on LWGEOM polygons.
void lwgeom_reverse_in_place(LWGEOM *lwgeom)
Reverse vertex order of LWGEOM.
void lwgeom_grid_in_place(LWGEOM *lwgeom, const gridspec *grid)
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...