geos_project()
and geos_project_normalized()
return
the distance of point geom2
projected on geom1
from the origin
of geom1
, which must be a lineal geometry.
geos_interpolate()
performs an
inverse operation, returning the point along geom
representing
the given distance
from the origin along the geometry.
_normalized()
variants use a distance normalized to the
geos_length()
of the geometry.
geos_project(geom1, geom2)
geos_project_normalized(geom1, geom2)
geos_interpolate(geom, distance)
geos_interpolate_normalized(geom, distance_normalized)
GEOS geometry vectors, recycled to a common length.
Distance along the linestring to interpolate
Distance along the linestring to interpolate relative to the length of the linestring.
geos_interpolate("LINESTRING (0 0, 1 1)", 1)
#> <geos_geometry[1]>
#> [1] <POINT (0.70711 0.70711)>
geos_interpolate_normalized("LINESTRING (0 0, 1 1)", 1)
#> <geos_geometry[1]>
#> [1] <POINT (1 1)>
geos_project("LINESTRING (0 0, 10 10)", "POINT (5 5)")
#> [1] 7.071068
geos_project_normalized("LINESTRING (0 0, 10 10)", "POINT (5 5)")
#> [1] 0.5