All the shapefiles necessary can be found here. These are shapefiles of lakes, and rivers. Downloading one shapefile as an example should be enough to get me on the right track.

The nuts file can be downloaded here.

What I want is to calculate the distance from each possible point in one nuts3-polygon to the nearest river. If all the distances are calculated from each point, I want to determine per nuts3-polygon what the average, minimum and maximum distance is to the nearest river, together with the standard deviation (if possible).

My paint skills are probably not the best ever, but the idea is something like this picture below (for each of the dots). Then I would calculate the average of all the brown lines that originates from a point in the polygon.

I can work a bit with R and ArcGis. Online I do not find a solution that matches what I am looking for.

enter image description here

  • Given there's an infinite number of points in a polygon I think the way to do it is to simulate a large number of points in the polygon with uniform density and average the distance to the nearest line. Have you used the rgeos package? That will compute point-line distances.
    – Spacedman
    Jul 12, 2016 at 15:57
  • This is most basic task using euclidian distance in and zonal statistics in arcgis
    – FelixIP
    Jul 12, 2016 at 19:37
  • Hey @FelixIP. Thanks for the hint. I have only access to ArcGis on Thursday but I will test it and keep you up to date. However, I already tried earlier in ArcGis and remember that I didn't get it to work. So if you know the specific steps that would help a lot. Otherwise, I'll let you know on Thursday!
    – user33125
    Jul 12, 2016 at 19:59
  • @Spacedman Thank you as well for your fast reaction and hint. I follow the logic in your comment. However, I have no experience with both suggestions. However, since I like working with R, I will try to make it work. If you could give me a hint on how to make the points in the polygon, you would help me again a lot!
    – user33125
    Jul 12, 2016 at 20:05
  • I think you should focus your question on where you are stuck using ArcGIS for Desktop. You can always research/ask about R separately.
    – PolyGeo
    Jul 12, 2016 at 20:24

1 Answer 1


I created distances rasters to all 3 types of water bodies (cell size = 1000m*1000m) and used cell statistics (min) to find nearest distance. After that I ran zonal statistics as table and joined results back to polygons.

This is how max distance looks like:

enter image description here

What you call nuts is a set overlapping polygons, make sure to remove all with status < 3.

  • Yes indeed, there are 4 levels of nuts. Nuts0, nuts1, nuts2 and nuts3. However, your steps go too fast for me. Could you provide a little bit more details? Thank you very much!
    – user33125
    Jul 13, 2016 at 8:10
  • There are 4 steps in my answer. How about following them and ask separate questions as you go. Even better use arcgis help system
    – FelixIP
    Jul 13, 2016 at 9:31
  • Hey @FelixIP , I managed to do the last steps for one shapefile at the time. However, I do not understand how to make a distance raster for all the three shapefiles at once. Could you please provide more details here? Right now I can calculate the distance to for instance large rivers. But I cannot calculate the distance to the first river (whether it is large or small). I guess to be able to do this I need to build these distance rasters but I can't make it work.
    – user33125
    Jul 19, 2016 at 9:12
  • 1
    You need 3 distance raster. After that run cell statistics (min) using all 3 of them
    – FelixIP
    Jul 19, 2016 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.