[R] generic question ==>> mapping Longhurst biogeochemical ocean provinces in R
Roger Bivand
Roger.Bivand at nhh.no
Tue Apr 29 12:30:40 CEST 2008
Maria Jose Juan Jorda <mjuanjorda <at> gmail.com> writes:
>
> Hello all
>
> I am a newbie to R plotting maps. I am trying to plot over a world map a
> layer of Biogeochemical provinces (BGCP) by A.R. Longhurst. Each ocean
> region unfortunately are quite irregular in shape (not perfect squares). In
> GIS this layer of ocean provinces would be a layer of polygons, which I am
> assuming it cannot be plotted with R.
>
> I was wondering If anybody has encounter this problem before, to plot a GIS
> layer of polygons into a map in R.
The CRAN repository has a tab in the left navigation bar, "Task Views". If you
look there, you'll see many guides to subject areas - in your case,
choose "Spatial". You will find sections for reading spatial data - if your
data can be represented as a shapefile, then reading them is not, in principle,
a problem. So the recipe could be as simple as:
library(rgdal)
BGCP <- readOGR(dsn=".", layer="BGCP")
# for the BGCP shapefile files (three or more files) in the working
# directory
spplot(BGCP, "BGCP")
# to plot the column named BGCP in the BGCP object with default
# plotting arguments (spplot is in the sp package loaded with rgdal)
Hope this helps,
Roger
More information about the R-help
mailing list