Efficiently calculate distance between raster patch edges

المشرف العام

Administrator
طاقم الإدارة
I have a binary raster which I've classified into patches using raster::clump. I now want to efficiently calculate the edge-to-edge, i.e. minimum, pairwise distance between patches. I am currently doing this by converting to polygons then using rgeos::gDistance; however, I need to do this with a large number of large rasters and I'm hoping there's a more efficient and direct method avoiding the conversion.

Here's what I have so far:

library(raster)library(igraph)library(rgeos)# 10x10 UTM raster with 1km resolutionutm10
 
أعلى