Search code examples
openlayersopenlayers-5openlayers-6

Openlayers 6: Simplifying a Feature<LineString> with properties


Background

I use Openlayer 6 where I have a Feature<LineString> which I want to simplify.

The solution display multiple Feature<LineString> which each has a property named velocities. The list of velocities corresponds 1-to-1 to the coordinates of the feature.

Question

Is there a way to simplify the Feature<LineString> via e.g. simplify() using the Douglas Peucker algorithm which simplifies both the coordinates and the corresponding properties e.g. velocities?


Solution

  • I ended up using https://github.com/mourner/simplify-js/tree/3d where you can simplify a 3d point x,y = point, and z is velocity.