[R] "Maps in R"
Baz
B.Rowlingson at lancaster.ac.uk
Tue Feb 22 12:17:48 CET 2000
I've just spent a couple of idle weekends getting a version of the
S-plus 'maps' library working under R.
For those unfamiliar with the maps library, it lets you map a
geographical region, split into areas, and optionally colour-fill
those areas according to some variable. For example:
R> library(maps)
R> map("state",c("california","nevada","washington"))
draws a line map of those three states.
R> map("uk",fill=T,color=pop.colour)
draws a map of the uk with counties coloured by the pop.colour
vector.
The system also supports map projections. You can do this:
R> map("state",proj="merc")
to draw the map on a mercator projection. I have used the USGS
PROJ4.2 projection library, and so there are many projections
and options available. I've also added a Great Britain Ordnance
Survey grid projection to PROJ4.2, for use with maps of this
area.
You can also do inverse projections - plot a map with a projection,
get locations with locator(), and then inverse-project them to get
back to lat-long coordinates.
That's all the good news. The bad news is that there's a few problems
here and there, mainly related to lines that cross the +180/-180
boundary
and to certain projections - an azimuthal projection (i.e. as you would
see the earth from space) of the world map doesn't do hidden-line
removal of the far side, it just crashes!
So I'm looking for interested parties to have a play with the code.
Preferably people with some experience of the S/Splus maps library, or
anyone with a geographical interest. It may even be worth starting from
scratch again and building an R-GIS package from the ground up...
Email me with your interest.
Barry Rowlingson
Maths and Stats
Lancaster University
Lancaster, UK
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list