How can I use a MultiLineStringM Geometry in Openlayers?

45 Views Asked by At

I would like to create features from a MultiLineStringM Geometry in Openlayers. Is that possible and, if yes, how?

The difference to a normal MultiLineString is that in a MultiLinestringM I have three values: 2 for coordinates and 1 for the meter.

The MultiLineStringM looks like this for example:

"MULTILINESTRINGM((
362854.5718999998 5691741.437899999 0,
362854.2510000001 5691741.3878 0.324773999995159,
362852.5449999999 5691741.1215 2.051373999995121,
362851.6495000003 5691740.957499999 2.961773999995785,
362849.2790999999 5691740.3333 5.412973999995302,
362849.1430000001 5691740.297499999 5.553773999996338,
362844.1265000002 5691737.835 11.14207399999577))"

I tried to read the Geometry with the WKT API like this:

const format = new WKT();
let geom = format.readGeometry(<String like shown above>);

But got this error: Error: Invalid geometry type: MULTILINESTRINGM

1

There are 1 best solutions below

0
Mike On BEST ANSWER

The correct syntax is

"MULTILINESTRING M((
362854.5718999998 5691741.437899999 0,
362854.2510000001 5691741.3878 0.324773999995159,
362852.5449999999 5691741.1215 2.051373999995121,
362851.6495000003 5691740.957499999 2.961773999995785,
362849.2790999999 5691740.3333 5.412973999995302,
362849.1430000001 5691740.297499999 5.553773999996338,
362844.1265000002 5691737.835 11.14207399999577))"