You can use an open source solution like GraphHopper.
You can test the commercial demo here:
but there is also a community version, which you can run on your own.
GraphHopper works on the basis of Open Street Map data, so if your area of operations is poorly mapped than it would not be a best way to go. However, you may always ...
You can get the locations of non-NA raster cells with as.data.frame(r, xy=TRUE, na.rm=TRUE) - that gives all the cells of your feature. Convert those to spatial points and then buffer them to get a polygonal buffer. You could then mask the full grid of points with that buffer and compute distances for only those points.
Use the sf package for your spatial ...
There are at least two convenient ways to find nearest neighbours in QGIS (point - line, and other geometry combinations).
The NNJoin Plugin (https://plugins.qgis.org/plugins/NNJoin/)
Since QGIS 3.8, the Join Attributes by Nearest algorithm (available in the QGIS Processing Toolbox)
You could try to use Linear Referencing tools such as LRS Plugin for QGIS. With linear referencing you can add a measure to your polyline (cable). This measure works like kilometer marks along a street and is stored in a new "dimension" so each vertices get's x, y and M-values. Once you calibrated your route, so that the measure is rising from your ...
Red: The layername of the red points
id: The unique id field in the Red layer.
Green: The layername of the green points
red_id: An identifier which suggests the point in Red layer. This corresponds to id in the Red layer.
Open attribute table of the Green layer and start the Field Calculator.
Create a new field dist (or ...
It is not possible to group by the 2 ID, because the min distance is needed to find to appropriate ID for the 2nd table.
Instead, the idea is to do a cross join to link every record of the 2nd table to every record of the 1st (with some conditions) and to pick the closest entry. All attributes of the 2nd table become available.
To use a spatial index, the ...
Assuming you have one geoseries with Points (for example you want to compare Point 1 to Point 2, Point 1 to Point 3,... ):
import geopandas as gpd
from itertools import combinations
from shapely.geometry import LineString
df = gpd.read_file(r"C:\data\vk_riks_Sweref_99_TM_shape\vagk\riks\js_riks.shp")
series = df.geometry
max_distance = 15000