distance_map.html 7.3 KB
 Facundo Muñoz committed Apr 04, 2019 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67  Compute a distance map to spatial features — distance_map • mapMCDA

Returns a distance map (in meters) to spatial features.

distance_map(x, boundaries, res = resolution(boundaries, min_ncells =   100))

Arguments

x

Spatial* object with relevant spatial features.

boundaries

SpatialPolygons* object with administrative  Facundo Muñoz committed Apr 04, 2019 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 borders, or Raster* object from where to pick the resoltion.

res

numeric. Resolution for the outcome distance map. The default divides the smallest dimension into 100 cells.

 Facundo Muñoz committed Apr 06, 2019 140 

Value

A raster map with distances in meters to the closest spatial feature.

Details

Distances are computed up to the given boundaries and at given resolution.

Examples

cmr <- mapMCDA_datasets() raster::plot(distance_map(cmr$water_bodies, boundaries = cmr$cmr_admin3))