diff --git a/src/ol/geom/linestring.js b/src/ol/geom/linestring.js index 6fde2a37e7..0a76be1014 100644 --- a/src/ol/geom/linestring.js +++ b/src/ol/geom/linestring.js @@ -27,6 +27,15 @@ ol.geom.LineString.prototype.getCoordinates = function() { }; +/** + * @return {number} Length. + */ +ol.geom.LineString.prototype.getLength = function() { + return ol.geom.flat.lineStringLength( + this.flatCoordinates, 0, this.flatCoordinates.length, this.stride); +}; + + /** * @inheritDoc */