Re-write the measure ordinate (or add one, if it isn't already there) interpolating the measure between the supplied start and end values.
59 int hasm = 0, hasz = 0;
60 double length = 0.0, length_so_far = 0.0;
61 double m_range = m_end - m_start;
66 lwerror(
"lwmline_measured_from_lmwline: only multiline types supported");
74 for ( i = 0; i < lwmline->
ngeoms; i++ )
90 for ( i = 0; i < lwmline->ngeoms; i++ )
92 double sub_m_start, sub_m_end;
93 double sub_length = 0.0;
101 sub_m_start = (m_start + m_range * length_so_far / length);
102 sub_m_end = (m_start + m_range * (length_so_far + sub_length) / length);
106 length_so_far += sub_length;
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
double ptarray_length_2d(const POINTARRAY *pts)
Find the 2d length of the given POINTARRAY (even if it's 3d)
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
void * lwalloc(size_t size)
LWLINE * lwline_measured_from_lwline(const LWLINE *lwline, double m_start, double m_end)
Add a measure dimension to a line, interpolating linearly from the start to the end value.
void lwerror(const char *fmt,...)
Write a notice out to the error handler.