def interpolatePoint(self, position): """ Interpolate a :class:`Point <geoscript.geom.Point>` on the :class:`LineString <geoscript.geom.LineString>` at the given position from 0 to 1. *position* is number between 0 and 1 """ indexedLine = LengthIndexedLine(self) length = self.getLength() coordinate = indexedLine.extractPoint(position * length) return Point(coordinate.x, coordinate.y)
def subLine(self, start, end): """ Extract a sub :class:`LineString <geoscript.geom.LineString>` using a start and end position. Both positions are numbers between 0 and 1. A new :class:`LineString <geoscript.geom.LineString>` is returned. *start* The start position between 0 and 1 *end* The end position between 0 and 1 """ indexedLine = LengthIndexedLine(self) length = self.getLength() return LineString(indexedLine.extractLine(start * length, end * length))
def placePoint(self, *coord): """ Place or snap the :class:`point <geoscript.geom.Point>` to the `LineString <geoscript.geom.LineString>`. This method returns a new placed `Point <geoscript.geom.Point>`. *coord* A :class:`Point <geoscript.geom.Point>` or a variable list of x,y,z arguments. """ point = coord[0] if isinstance(coord[0], Point) else Point(*coord) indexedLine = LengthIndexedLine(self) position = indexedLine.indexOf(point.coordinate) coord = indexedLine.extractPoint(position) return Point(coord.x, coord.y)
def locatePoint(self, *coord): """ Locate the position of the :class:`point <geoscript.geom.Point>` along this :class:`LineString <geoscript.geom.LineString>`. The position returned is a number between 0 and 1. *coord* A :class:`Point <geoscript.geom.Point>` or a variable list of x,y,z arguments. """ point = coord[0] if isinstance(coord[0], Point) else Point(*coord) indexedLine = LengthIndexedLine(self) position = indexedLine.indexOf(point.coordinate) percentAlong = position / self.getLength() return percentAlong