pub fn length<G>(
g: &G,
) -> <<<<<G as Geometry>::Point as Point>::Cs as CoordinateSystem>::Family as DefaultLength<<<<G as Geometry>::Point as Point>::Cs as CoordinateSystem>::Family>>::Strategy as LengthStrategy<G>>::Outwhere
G: Linestring,
<<<G as Geometry>::Point as Point>::Cs as CoordinateSystem>::Family: DefaultLength<<<<G as Geometry>::Point as Point>::Cs as CoordinateSystem>::Family>,
<<<<G as Geometry>::Point as Point>::Cs as CoordinateSystem>::Family as DefaultLength<<<<G as Geometry>::Point as Point>::Cs as CoordinateSystem>::Family>>::Strategy: LengthStrategy<G> + Default,Expand description
Sum the per-segment distance along a linestring using the default strategy for its coordinate-system family.
Mirrors boost::geometry::length from
boost/geometry/algorithms/length.hpp. The strategy is resolved
via geometry_strategy::DefaultLengthStrategy — Cartesian input
resolves to the Pythagorean geometry_strategy::CartesianLength
(identical to the v1 behaviour), spherical to Haversine, geographic
to Andoyer. For an explicit strategy use length_with.
§Behaviour on “wrong” kinds
This static entry point deliberately compile-errors on a Point
or Polygon argument
(Boost returns 0 at runtime; when the kind is known
at compile time a type error is a clearer signal). The runtime
contract — Boost’s “length of a non-linear kind is 0”
(length.hpp:75-80) — is honoured on the dynamic path instead:
crate::length_dyn returns 0 for Point,
Polygon, MultiPoint, ….