shapely.line_interpolate_point#
- line_interpolate_point(line, distance, normalized=False, **kwargs)#
Returns a point interpolated at given distance on a line.
- Parameters:
- lineGeometry or array_like
For multilinestrings or geometrycollections, the first geometry is taken and the rest is ignored. This function raises a TypeError for non-linear geometries. For empty linear geometries, empty points are returned.
- distancefloat or array_like
Negative values measure distance from the end of the line. Out-of-range values will be clipped to the line endings.
- normalizedbool, default False
If True, the distance is a fraction of the total line length instead of the absolute distance.
- **kwargs
For other keyword-only arguments, see the NumPy ufunc docs.
Examples
>>> from shapely import LineString, Point >>> line = LineString([(0, 2), (0, 10)]) >>> line_interpolate_point(line, 2) <POINT (0 4)> >>> line_interpolate_point(line, 100) <POINT (0 10)> >>> line_interpolate_point(line, -2) <POINT (0 8)> >>> line_interpolate_point(line, [0.25, -0.25], normalized=True).tolist() [<POINT (0 4)>, <POINT (0 8)>] >>> line_interpolate_point(LineString(), 1) <POINT EMPTY>