Closed bgeorgios closed 1 year ago
As commented on your post on Stack Overflow, the function works as expected on my machine. I can't help you if you don't provide a reproducible example...
bath.data <- raster("exportImage.tiff") bath.data <- as.bathy(bath.data) is.bathy(bath.data) point <- data.frame(Longitude=-122.465, Latitude=37.807) buf <- create.buffer(x = bath.data, loc = point, radius=0.2, km=TRUE)
This is neither a problem in marmap
nor adehabitatMA
, so I'm closing the issue.
Your bathy
object has a resolution of 15 arcsecond (0.25 arcminute). At the latitude of your desired buffer, this represents ca. 364 meters per cell (see here for conversions). So with a radius of 0.2 km, the buffer you're asking for is less than 2 cells of your bathy grid in diameter. You cannot create a buffer with only 1 cell... This would not be a buffer, but merely a point. Hence the error message.
If you ask for a buffer with a 1 km radius (buf <- create.buffer(x = bath.data, loc = point, radius=1, km=TRUE)
), or even with a 400m radius, you'll see that the function works just as expected. But then again, considering the scale of your bathy data, such a buffer would be barely visible on a map, and it would be more "squarish" than circular.
In conclusion, you either need a much larger radius, or a much finer scale bathy
object to work with such a small buffer.
Hi,
I've been trying to use create.buffer but it won't work! I just have a 'bathy' object, put the radius in kilometers and a 2-column dataframe of the point but it will pop up an error pointing to the adehabitatMA dependency.
Any help would be appreciated 👍🏻