Trajectories and Network Geometry Processing#
algo.geometry Module#
This module provides functions for managing the geometry of network edges and GNSS trajectories.
The algorithms documented below are used to modify, connect, or adjust geometries during the construction of the mobility network.
Searches for the closest network edge that intersects an extension of a given edge. |
|
Move trajectory points closer to neighboring trajectories to make spatially close trajectories more tightly clustered. |
|
Snap lines representing network arcs to connect them within a given tolerance. |
Find a connection candidate#
Searches for the closest network edge that intersects an extension of a given edge.
This function can be used to identify a potential connection between network edges that are not directly connected.
Move trajectories closer together#
This algorithm moves trajectory points closer to neighboring trajectories, making spatially close trajectories more tightly clustered.
This preprocessing step can facilitate the detection of common movement patterns and the subsequent construction of the network.
On the left, the trajectories are relatively sparse. On the right, after applying the algorithm, the trajectories are more tightly clustered, making common spatial patterns easier to detect.#
- pull_point_to_other_tracks(cutCollection, buffer_size=10, alpha=0.6)[source]#
Move trajectory points closer to neighboring trajectories to make spatially close trajectories more tightly clustered.
For each trajectory point, neighboring trajectory points within a given buffer are identified. The point is then moved towards the centroid of these neighboring points. The displacement is controlled by alpha.
This operation is intended to bring trajectories closer together between two successive iterations of the workflow, in order to assess whether this improves the detection of spatial patterns in the resulting network.
Parameters#
- cutCollectionTrackCollection
Collection of trajectories to be processed.
- buffer_sizefloat, optional
Size of the buffer used to identify neighboring trajectory points, in the units of the coordinate reference system. Default is 10.
- alphafloat, optional
Weight controlling the displacement of each point towards the centroid of neighboring points. A value of 0 leaves the point unchanged, while a value of 1 moves it to the centroid. Default is 0.6.
Returns#
- TrackCollection
A new collection containing the trajectories with their points moved towards neighboring trajectories.
Connect nearby network edges#
This algorithm connects network edges that are close to each other.
Two edges are connected only when their distance is smaller than the
specified tolerance.
On the left, the network edges are not connected. On the right,
nearby edges have been connected when their distance is smaller than
the specified tolerance.#
- snap_lines_to_connect(collection, tolerance=1, log_level='ERROR')[source]#
Snap lines representing network arcs to connect them within a given tolerance.
- This operation handles the splitting of lines when snapping occurs
away from their endpoints. However, it does not handle the small line segments created by this splitting operation.
Parameters#
- collectionTrackCollection
Collection of line geometries representing network arcs.
- tolerancefloat, optional
Maximum distance within which line geometries are snapped together, in the units of the coordinate reference system. Default is 1.
- log_levelstr, optional
Logging level used during the operation. Default is ‘ERROR’.
Returns#
- TrackCollection
A new collection containing the snapped line geometries.