I have found questions here of how to compute the distance of a point to a line (manually, with distance method of some libraries...) but my problem is that I need to compute the distance of 4M points to 9K lines, and keep points that are closer than a specific distance. I'm doing it with Python 3.5
for i in range(len(multip)): #Shapely Multipoint object while j < len(network): # .shp file opened GeoDataFrame object from geopandas dist = network[j].distance(multip[i]) print('dist', dist) if (dist <= critdist): count += 1 xxx = (multip[i].x) yyy = (multip[i].y) distlist = np.append(distlist, dist) critcoordx = np.append(critcoordx, xxx) critcoordy = np.append(critcoordx, yyy) j = 0 break j += 1 j = 0
I couldn't come up with a solution to vectorize this process.
I also tried things like:
But it does not compute individual distances.