blasee / fetchR

Calculate Wind Fetch in R
4 stars 3 forks source link

fetch from coastline #8

Closed annacb closed 6 years ago

annacb commented 6 years ago

Hello! I am trying to calculate fetch from the coastline of my spatial polygon, but because of the way this function is written, it counts the coastline as "on land" and will not calculate fetch. Is there a way to modify the code to get around this? Thanks

blasee commented 6 years ago

The fetch() function considers points on the coastline as being located on land. To calculate wind fetch at locations on the coastline, you can simply shrink the polygon object using a small, negative value for the width argument in the rgeos::gBuffer() function before calculating fetch. If you have multiple polygons, you will also want to use byid = TRUE, for example:

my_shrunk_polygon = rgeos::gBuffer(my_polygon, width = -1, byid = TRUE)