lair.transects.merge_route_points#
- lair.transects.merge_route_points(routes_xy, tol)[source]#
Merge the fixed points of several routes into one network point set.
Points of the first route are kept; a point of a later route is added only if it is farther than
tolfrom every point already in the set, otherwise it is snapped to the nearest existing one. Shared track thus maps to shared network points.- Parameters:
- Returns:
tuple[np.ndarray, list[np.ndarray]] –
(network_xy, index): the network points, and per route the network point of each of its points (index[i][k]for routei’s pointk).- Return type:
See also
pool_routesStacks the routes’ matrices onto the network points.
Examples
The second route shares two points with the first (within 50 m) and adds one:
>>> import numpy as np >>> from lair.transects import merge_route_points >>> r1 = np.array([[0, 0], [1000, 0], [2000, 0.0]]) >>> r2 = np.array([[1000, 10], [2000, 5], [2000, 1000.0]]) >>> network, index = merge_route_points([r1, r2], tol=50) >>> network array([[ 0., 0.], [1000., 0.], [2000., 0.], [2000., 1000.]]) >>> index [array([0, 1, 2]), array([1, 2, 3])]