Re: [R] generic question ==>> mapping Longhurst biogeochemical ocean provinces in R

From: Roger Bivand <Roger.Bivand_at_nhh.no>
Date: Tue, 29 Apr 2008 10:30:40 +0000 (UTC)

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



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 29 Apr 2008 - 10:47:50 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Apr 2008 - 11:30:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive