PostGIS  2.3.7dev-r@@SVN_REVISION@@
static void test_lwgeom_locate_along ( void  )
static

Definition at line 456 of file cu_measures.c.

References LW_PARSER_CHECK_NONE, lwfree(), lwgeom_free(), lwgeom_from_wkt(), lwgeom_locate_along(), lwgeom_to_wkt(), and WKT_ISO.

Referenced by measures_suite_setup().

457 {
458  LWGEOM *geom = NULL;
459  LWGEOM *out = NULL;
460  double measure = 105.0;
461  char *str;
462 
463  /* ST_Locatealong(ST_GeomFromText('MULTILINESTRING M ((1 2 3, 5 4 5), (50 50 1, 60 60 200))'), 105) */
464  geom = lwgeom_from_wkt("MULTILINESTRING M ((1 2 3, 5 4 5), (50 50 1, 60 60 200))", LW_PARSER_CHECK_NONE);
465  out = lwgeom_locate_along(geom, measure, 0.0);
466  str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
467  lwgeom_free(geom);
468  lwgeom_free(out);
469  CU_ASSERT_STRING_EQUAL("MULTIPOINT M (55.226131 55.226131 105)", str);
470  lwfree(str);
471 
472  /* ST_Locatealong(ST_GeomFromText('MULTILINESTRING M ((1 2 3, 5 4 5), (50 50 1, 60 60 200))'), 105) */
473  geom = lwgeom_from_wkt("MULTILINESTRING M ((1 2 3, 3 4 2, 9 4 3), (1 2 3, 5 4 5), (50 50 1, 60 60 200))", LW_PARSER_CHECK_NONE);
474  out = lwgeom_locate_along(geom, measure, 0.0);
475  str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
476  lwgeom_free(geom);
477  lwgeom_free(out);
478  CU_ASSERT_STRING_EQUAL("MULTIPOINT M (55.226131 55.226131 105)", str);
479  lwfree(str);
480 }
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
Definition: lwout_wkt.c:669
void lwfree(void *mem)
Definition: lwutil.c:242
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1063
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1985
#define WKT_ISO
Definition: liblwgeom.h:2055
LWGEOM * lwgeom_locate_along(const LWGEOM *lwin, double m, double offset)
Determine the location(s) along a measured line where m occurs and return as a multipoint.

Here is the call graph for this function:

Here is the caller graph for this function: