I can append lineStrings with appendLineString method. But how to remove them? I tried to splice them from the getLineStrings array, but without success.
The closest I came was:
//multiLineString is my ol.geom.MultiLineString object
multiLineString.setCoordinates([]);
Thanks
This works for me:
var multi = new ol.geom.MultiLineString([[[1,2],[2,3],[1,4]],[[2,1],[3,2],[4,1]]]);
var singles = multi.getLineStrings(); //returns an array of 2 LineStrings
singles.splice(0,1);
multi.setLineStrings(singles);
multi.getLineStrings(); //returns a single LineString
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.