airbornegeo.create_intersection_table#
- create_intersection_table(data, *, line_column, method, exclude_ints=None, cutoff_dist=None, buffer_dist=None, proximity_dist=None, block_size=None, min_spacing=None, grid_size=1, progressbar=True)[source]#
Create a dataframe which contains the intersections between all combinations of lines. For each intersection point, find the distance to the closest data point of each line. If the further of these two distances is greater than “cutoff_dist”, the intersection is excluded. The intersections are calculated by representing the point data as lines, and finding the hypothetical crossover. By default crossovers will only be within the endpoints of each line. If there is an expected crossover just beyond the end of a line which should be included, use the buffer_dist arg to extend the line representation of the data, but note that extrapolation of data at these points will likely be inaccurate if buffer distance is too large. If lines intersection very often, duplicate intersections within a window, specified by grid_size, can be excluded.
Effect of buffer_dist: Original (no intersection):
A —————-
B
- With buffer (1 intersection):
- A ———-x———-
B
- Parameters:
data (
DataFrame|GeoDataFrame) – Dataframe with survey data, with columns ‘easting’ and ‘northing’ (or an existing ‘geometry’ column of points).line_column (
str) – Column name containing the line / flight / segment namesmethod (
str) – Choose between “groups” where two categories of lines are supplied, such as survey lines and tie lines, and intersections are only found between these two groups, or ‘network’ where all intersections between any supplied lines are found. If “groups”, column ‘line_type’ must be provided with possible values 0, 1, or 2, where 0 denotes the first category, 1 denotes the second category, and 2 denotes lines to be excluded.exclude_ints (
list[Any|tuple[Any,Any]] |None) – Iterable where each element is either a single line number, to exclude all of that line’s intersections, or a list/tuple/array of the two line numbers (in either order) of a specific intersection to exclude, by default Nonecutoff_dist (
float|None) – The maximum allowed distance from a theoretical intersection to the further of nearest data point of each intersecting line, by default Nonebuffer_dist (
float|None) – The distance to extend the line representation of the data points, useful for creating intersection which are just beyond the end of a line, by default Noneproximity_dist (
float|None) – If set, line pairs which come within this distance of each other are also considered to cross, even if they never actually intersect (e.g. roughly parallel lines which converge to within proximity_dist but extending the line ends with buffer_dist still creates no crossing). For every data vertex of one line within proximity_dist of the other line, a crossover is created at the midpoint between that vertex and the nearest point on the other line. This can create many crossovers where lines run close together; reduce them with block_size. These crossovers are flagged in the is_proximity column, by default Noneblock_size (
float|None) – For a spatial block of this width, intersection within with the same pairs of lines (duplicates) will be dropped, except the intersection with the lowest min_dist. This is useful for when lines cross very often.min_spacing (
float|None) – Like block_size, but measured in 1D distance along the lines instead of in a 2D spatial window: an intersection is dropped if a better one of the same line pair is within min_spacing along both lines. Unlike block_size, this retains spatially-close crossings which are far apart along one of the lines (e.g. a hairpin re-crossing). If both block_size and min_spacing are given, an intersection must clear both tests to be kept, by default Nonegrid_size (
float) – The resolution to snap the intersection coordinates to. by default 1progressbar (
bool) – Show a progress bar while calculating intersections, by default True.
- Returns:
An intersection table containing the locations of the theoretical intersections, the intersecting lines numbers, and the distance to the further of the two nearest datapoints of each line, and a geometry column.
- Return type:
GeoDataFrame