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

◆ test_lwgeom_locate_along()

static void test_lwgeom_locate_along ( void  )
static

Definition at line 728 of file cu_measures.c.

729{
730 LWGEOM *geom = NULL;
731 LWGEOM *out = NULL;
732 double measure = 105.0;
733 char *str;
734
735 /* ST_Locatealong(ST_GeomFromText('MULTILINESTRING M ((1 2 3, 5 4 5), (50 50 1, 60 60 200))'), 105) */
736 geom = lwgeom_from_wkt("MULTILINESTRING M ((1 2 3, 5 4 5), (50 50 1, 60 60 200))", LW_PARSER_CHECK_NONE);
737 out = lwgeom_locate_along(geom, measure, 0.0);
738 str = lwgeom_to_wkt(out, WKT_ISO, 6, NULL);
739 lwgeom_free(geom);
740 lwgeom_free(out);
741 ASSERT_STRING_EQUAL(str, "MULTIPOINT M ((55.226131 55.226131 105))");
742 lwfree(str);
743
744 /* ST_Locatealong(ST_GeomFromText('MULTILINESTRING M ((1 2 3, 5 4 5), (50 50 1, 60 60 200))'), 105) */
745 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);
746 out = lwgeom_locate_along(geom, measure, 0.0);
747 str = lwgeom_to_wkt(out, WKT_ISO, 6, NULL);
748 lwgeom_free(geom);
749 lwgeom_free(out);
750 ASSERT_STRING_EQUAL(str, "MULTIPOINT M ((55.226131 55.226131 105))");
751 lwfree(str);
752}
#define ASSERT_STRING_EQUAL(o, e)
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
#define LW_PARSER_CHECK_NONE
Definition liblwgeom.h:2149
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
Definition lwout_wkt.c:708
void lwfree(void *mem)
Definition lwutil.c:248
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.
#define WKT_ISO
Definition liblwgeom.h:2219
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition lwin_wkt.c:940
#define str(s)

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

Referenced by measures_suite_setup().

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