Monday, 8 October 2018

qgis - Calculating all distances from single points to multiple polygons



I have two layers: a point layer defining properties (95 objects), and a polygon layer defining plots of land associated with the properties (211 objects). Each point relates to one or more polygons. What I would like to produce is a table of distances of each point to ALL of the polygons associated with that point (nearest edge or centroid of polygon -- either will do). Calculating the nearest distance is relatively easy in QGIS and ArcGIS, but those calculations omit all distant polygons, at least by the methods I have been employing. Ideally I would like an output of


Point_ID | distance to polygon 1 | distance to polygon 2 | distance to polygon 3 | etc.

Any pointers in ArcGIS 10 or QGIS 2.2+ would be most helpful.




Answer



You can use the Distance Matrix in QGIS to achieve this. You would first need to convert your polygons into centroid points by either Vector > Geometry Tools > Polygon centroids or via the SAGA version of polygon centroids. Reason for this is the Distance Matrix function can only analyse between 2 point layers. Also, the output would be like this:


Point_1 | PolygonCentroid_1 | Distance
Point_1 | PolygonCentroid_2 | Distance
Point_1 | PolygonCentroid_3 | Distance
Point_2 | PolygonCentroid_1 | Distance
Point_2 | PolygonCentroid_2 | Distance

The output would be a .csv file so you could manually edit the layout using another software such as Microsoft Excel.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...