0

ArcGIS Pro offers the Average Nearest Neighbour Distance geoprocessing tool to measure the distance between each feature centroid and its nearest neighbour's centroid location. It then averages all these nearest neighbour distances and provides a report of: Observed Mean Distance, Expected Mean Distance, Nearest Neighbour Index, z-score, and p-value

For more information on how the tool works see below: https://pro.arcgis.com/en/pro-app/latest/tool-reference/spatial-statistics/h-how-average-nearest-neighbor-distance-spatial-st.htm

I'm curious as to whether any Python modules offer similar functionality? I'd like to be able to incorporate some kind of nearest neighbour analysis in future scripts - in particular, observed mean distance and expected mean distance.

PolyGeo
  • 65,136
  • 29
  • 109
  • 338

2 Answers2

0

You can try with networkx. First the data should be converted into networkx graph nodes and edges using python code. https://networkx.org/documentation/stable/tutorial.html Then use the inbuilt methods of networkx to find distance, nearest neighbour etc. https://networkx.org/documentation/networkx-1.9/reference/generated/networkx.algorithms.assortativity.k_nearest_neighbors.html

Sreejith V
  • 21
  • 5
-1

Yes, there is a tool like this. Have a look at https://docs.qgis.org/3.22/en/docs/user_manual/processing_algs/qgis/vectoranalysis.html#qgisnearestneighbouranalysis

Mazu_R
  • 1,102
  • 9
  • 15