1

I am creating an INLA mesh using the coastline as my boundry. I am getting some extra spaces or triangles on the right side of my mesh. I want to setup the coastline as my boundry of the mesh, so I don't have any triangles on the land. In the second picture you can see the coastline I want to use as boundary for my mesh. enter image description here enter image description here

Below is the code I used to create my mesh
#Building the mesh

mesh.loc <- SpatialPoints(as.matrix(coo)) # point coordinate 
mesh <- inla.mesh.2d(loc=mesh.loc, max.edge=7e3, cutoff = 0.1, crs=4326) # max.edge= 7e3 to specify the length of my triangle 

plot(mesh, main="") # plot the INLA mesh
points(coo, pch=20,col="Dark Green") # green dot locations of the data frame points on the mesh

create a polygon with coastline to constraint the INLA mesh

lon = c(-4, 2.5, 2.5,-4) #lon for the FOF
lat = c(55, 55, 58, 58) #lat for the FOF

Poly2_Coord_df = data.frame(lon, lat)

poly_2 <- Poly2_Coord_df %>% 
  st_as_sf(coords = c("lon", "lat"), 
           crs = 4326) %>% 
  st_bbox() %>% 
  st_as_sfc()

FOF_bound_2<- st_difference(poly_2,coast) # crop the FOF polygone with the UK coastline

FOF_bound_pol<-st_as_sf(FOF_bound_2,crs=4326) # setting my coastline boundaries as the shapefile
Usman YousafZai
  • 1,088
  • 4
  • 18
  • 44

0 Answers0