[R-sig-Geo] How to mask the area around a raster map with a buffer?

Sohrab Abbasnejad @ohr@b@@bb@@nej@d @end|ng |rom y@hoo@com
Thu Jan 31 16:35:09 CET 2019


Dear all,

I have a dataframe with around 90k observations over an area including a continent (a raster object), and a variable of interest whose values I want to visualize on a map. I have used levelplot function from lattice package to visualize the data, and added a map of the continent to the plot as a layer (using a shapefile). So far, so good.

My area of interest is the continent itself, but my data covers a larger area (including the oceans around the continent). I would like to keep the whole map but mask the ocean around the continent (with a buffer of 100km) and keep the values only for the continent.

I would appreciate it if someone could help me achieve this.

Thank you in advance,
Sohrab

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list