I want to connect a line between every two points which are away from each other by specific distances.
Are there tools do that?
In case it is, here is an example. I have these points:
Then you run the Generate Near Table tool using the same input as near features and setting a search distance (I used 500m) and select the Location option and uncheck the Find only closest feature:
The result is a table with the from and near locations:
Next you can run this script:
def main():
import arcpy
tbl = r'C:\GeoNet\NearLines\data.gdb\near_table'
fc = r'C:\GeoNet\NearLines\data.gdb\lines'
sr = arcpy.SpatialReference(3857)
feats = []
flds = ('FROM_X', 'FROM_Y', 'NEAR_X', 'NEAR_Y')
with arcpy.da.SearchCursor(tbl, flds) as curs:
for row in curs:
polyline = arcpy.Polyline(arcpy.Array([arcpy.Point(row[0], row[1]),
arcpy.Point(row[2], row[3])]),
sr)
feats.append(polyline)
arcpy.CopyFeatures_management(feats, fc)
if __name__ == '__main__':
main()
which will generate this lines:
Thank you for your reply and I scenery appreciate your effort. I need to connect the point one time only to the point which is within a certain distance. For example, I want to connect a line between point # 3 and point #55 as shown in the attached image.
.
We have been down this path before ... and I responded in an earlier post https://community.esri.com/message/734028-re-points-to-lines?commentID=734028#comment-734028
You need to specify the distances or distance range.
A simple query for the values that are within the range will give you those points.
From there you can construct origin destination pairs as outlined using similar procedures specified by xander_bakker
Once the data set is obtained, the remainder of the task will take little time.
Perhaps in your next screen grab, you can show a query result of the points that meet your conditions. It is hard to get a feel for how many points you have. If there were only a handful ... less than a 25 or so, it would be as quick to connect the dots manually in an edit session.