/** * Extraction of a sub-LineString from an existing line, starting from 0; * * @param ls the line from which we extract the sub LineString () * @param fraction [0..1], the length until where we want the substring to go * @return the sub-LineString */ LineString getSubLineString(LineString ls, double fraction) { if (fraction >= 1) return ls; LengthIndexedLine linRefLine = new LengthIndexedLine(ls); LineString subLine = (LineString) linRefLine.extractLine(0, fraction * ls.getLength()); return subLine; }