Skip to contents

Adds coordinates along a LineString ensuring that no two coordinates are further than a maximum distance apart from eachother.

Usage

densify_euclidean(x, max_distance)

densify_haversine(x, max_distance)

Arguments

x

an object with linear geometries. Can be an rsgeo object except "rs_POINT" or "rs_MULTIPOINT".

max_distance

the maximum allowed distance between coordinates.

Details

max_distance expects meters for densify_haversine() whereas densify_euclidean() expects the units of the geometry.

Be sure to use the appropriate densification function based on the type of geometries you have. rsgeo does not check if your coordinates are geographic or planar. It is up to you to choose the correct algorithm.

Examples


line <- geom_linestring(1:10, 10:1)
densify_euclidean(line, 0.5)
#> <rs_LINESTRING[1]>
#> [1] LineString([Coord { x: 1.0, y: 10.0 }, Coord { x: 1.3333333333333333, y: 9...
densify_haversine(line, 100000)
#> <rs_LINESTRING[1]>
#> [1] LineString([Coord { x: 1.0, y: 10.0 }, Coord { x: 1.500730206948808, y: 9....