I have 2 sets of Polygons and I need to calculate the shortest distance between the polygons on one layer to the single polygon (one feature) on the other layer! How can I do that? Any help on how to accomplish this in QGIS?
The real world case is to calculate the shortest distance from the edge of a land parcel to the water/ocean. I will need to do this once or twice, but the multiple polygon layer has 10k's of features).
Being not of many words I have included an image of what I need to do!
Best Answer
Since you don't need to perform this task in a programmatically way, you may follow these simple steps:
Copy the result (just double click on the line which starts with Polygon ((...)) and then ctrl+c);
Select the land parcel layer from the Layers Panel and then open the Field Calculator. Create a new field with the following expression (see the image below):
Obviously, you need to replace the above WKT Polygon with your case. Furthermore, I assumed you wanted a field with decimals, so adapt it to your case.