Hi - I've been making elevational maps of several countries, but for some
reason the code won't work for New Zealand:
library(raster)
x <- getData('alt', country = "NZ")
plot(x)
colfunc <- colorRampPalette(c("black", "white"))
plot(x,col=(colfunc(50)), cex.axis=1, las=1)
title(xlab = "Longitude (degrees E)", ylab="Latitude (degrees S)")
This makes perfectly good maps of plenty of countries (e.g. Australia,
Spain, France) but when I write "country = "NZ" " on line 2, here's what
happens:
x <- getData('alt', country = "NZ")
Error in xy.coords(x, y, xlabel, ylabel, log) :
'x' is a list, but does not have components 'x' and 'y'
colfunc <- colorRampPalette(c("black", "white"))
plot(x,col=(colfunc(50)), cex.axis=1, las=1)
Error in xy.coords(x, y, xlabel, ylabel, log) :
'x' is a list, but does not have components 'x' and 'y'
title(xlab = "Longitude (degrees E)", ylab="Latitude (degrees S)")
I'd really appreciate advice on how to fix this, or other approaches that
might work for NZ. As you can see above, R found the data, but didn't make
the map.
thanks
Chris
--
Dr. Chris Lusk
Environmental Research Institute
The University of Waikato
Private Bag 3105, Hamilton
New Zealand / Aotearoa
http://sci.waikato.ac.nz/sites/clusk/
Ph 64 7 838 4205
~ ~ ~ ~ ~ ~ ~
[[alternative HTML version deleted]]