I have a shapefile containing 10 test points like so:
The spatial reference is 2157 - Irish Transverse Mercator
I am wanting to find the distance between each point in Python. Ideally, something like so Finding points that are within a set distance of other points
I tried the below code using fiona
and shapely
as a starting point
import fiona
import shapely.geometry
with fiona.open(r'c:/test/points.shp') as src:
for feature in src:
geom = shapely.geometry.shape(feature["geometry"])
distance_between_pts = geom.distance(geom)
print(distance_between_pts)
However this just prints 0.0 ten times.
I'm not sure how to find the distance between each point. Or even if I were able to pick a point and return the points which fall within a certain distance would help
for
loops O(n^2/2)