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

◆ test_geos_makevalid()

static void test_geos_makevalid ( void  )
static

Definition at line 139 of file cu_geos.c.

140{
141 uint8_t* wkb;
142 char* out_ewkt;
143 LWGEOM* geom1;
144 LWGEOM* geom2;
145 LWGEOM* geom3;
146
147 wkb = (uint8_t*) "\001\003\000\000\000\001\000\000\000\011\000\000\000b\020X9 }\366@7\211A\340\235I\034A\316\326t18}\366@\306g\347\323\230I\034Ay\351&18}\366@\331\316\367\323\230I\034A\372~j\274\370}\366@\315\314\314LpI\034A\343\245\233\304R}\366@R\270\036\005?I\034A\315\314\314\314Z~\366@\343\245\233\304\007I\034A\004V\016-\242}\366@\252\361\322M\323H\034A\351&1\010\306{\366@H\341z\0247I\034Ab\020X9 }\366@7\211A\340\235I\034A";
148 geom1 = lwgeom_from_wkb(wkb, 157, LW_PARSER_CHECK_NONE);
149 geom2 = lwgeom_make_valid(geom1);
150 geom3 = lwgeom_normalize(geom2); //so GEOS 3.9 and 3.10 agree
151 out_ewkt = lwgeom_to_ewkt((LWGEOM*)geom3);
152
153#if POSTGIS_GEOS_VERSION < 30900
155 out_ewkt,
156 "GEOMETRYCOLLECTION(POLYGON((92092.377 463437.77,92114.014 463463.469,92115.51207431706 463462.206937429,92115.512 463462.207,92127.546 463452.075,92117.173 463439.755,92133.675 463425.942,92122.136 463412.82600000006,92092.377 463437.77)),MULTIPOINT(92122.136 463412.826,92115.51207431706 463462.2069374289))");
157#else
159 out_ewkt,
160 "POLYGON((92092.377 463437.77,92114.014 463463.469,92115.512 463462.207,92115.51207431706 463462.2069374289,92127.546 463452.075,92117.173 463439.755,92133.675 463425.942,92122.136 463412.826,92092.377 463437.77))");
161#endif
162 lwfree(out_ewkt);
163 lwgeom_free(geom1);
164 lwgeom_free(geom2);
165 lwgeom_free(geom3);
166}
#define ASSERT_STRING_EQUAL(o, e)
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
#define LW_PARSER_CHECK_NONE
Definition liblwgeom.h:2149
LWGEOM * lwgeom_normalize(const LWGEOM *geom)
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an allocated string.
Definition lwgeom.c:593
void lwfree(void *mem)
Definition lwutil.c:248
LWGEOM * lwgeom_from_wkb(const uint8_t *wkb, const size_t wkb_size, const char check)
WKB inputs must have a declared size, to prevent malformed WKB from reading off the end of the memory...
Definition lwin_wkb.c:842
LWGEOM * lwgeom_make_valid(LWGEOM *geom)
Attempts to make an invalid geometries valid w/out losing points.

References ASSERT_STRING_EQUAL, LW_PARSER_CHECK_NONE, lwfree(), lwgeom_free(), lwgeom_from_wkb(), lwgeom_make_valid(), lwgeom_normalize(), and lwgeom_to_ewkt().

Referenced by geos_suite_setup().

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