cartagen.resample_line#
- resample_line(line, step, keep_vertices=False)#
Densify a line by adding vertices.
This function densifies a line by adding a vertex every ‘step’ along the line. It preserves the first and last vertex of the line.
- Parameters:
line (
LineString) – The line to densify.step (
float) – The step (in meters) to resample the geometry.keep_vertices (
bool, optional) – If set to true, original vertices of the line are kept. This is useful to keep the exact same geographical shape.
- Returns:
Examples
>>> line = LineString([(1, 1), (5, 1)]) >>> resample_line(line, 1) <LINESTRING (1 1, 2 1, 3 1, 4 1, 5 1)>