I have two vector layers: one point and one polygon and I want to calculate the minimum distance of each point from the polygons (ie the distance from the closest point of the closest polygon).
Is there any available plugin in QGIS for doing this?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityI have two vector layers: one point and one polygon and I want to calculate the minimum distance of each point from the polygons (ie the distance from the closest point of the closest polygon).
Is there any available plugin in QGIS for doing this?
Converting your polygon to points first is a bad idea. You will not be calculating the distance to your polygon, you will be calculating the distance to the closest node of your polygons (not the edges which may be closer). You can use the NNJoin Plugin to get accurate measurements to your polygon. Make sure your layers are in the same projection before doing analysis.
If you want to use QGIS, the GRASS v.distance function in the GRASS plugin should do the job. The NNJoin plugin should work for small datasets, and is less cumbersome to use.
The NNJoin plugin uses the QgsGeometry.distance() function (which uses the GEOSdistance) to calculate the distances.
First convert the polygon to points:
Vector -> Geometry Tools -> Extract Nodes
Add this new layer, then calculate a distance matrix between your points layer and the new polygon-points layer you just created
Vector -> Analysis Tools -> Distance Matrix
Be sure to choose "Use only the nearest (k) target points" as 1