Skip to content
Prev 22434 / 29559 Next

gdistance: costDistance with barriers

Karl,

You are using a default RasterLayer which has lon/lat coordinates. In
that case the earth is considered spherical (or similar), not a plane.
The maximum possible distance in longitude is 180 degrees, and the
distance between -120 and 120 is not 240 degrees, but 60+60= 120
degrees, .

To get the results I think you expected, use a planar CRS. For example
r <- raster(nrows=18, ncols=36, crs='+proj=utm +zone=10')

Robert
On Thu, Mar 12, 2015 at 11:35 AM, karljarvis <karljarvis at gmail.com> wrote: