[R-sig-Geo] converting SRTM data to filled contour plot

Ian Harrison ihcover-junk at yahoo.com
Wed Aug 13 17:14:52 CEST 2008


Hello,

I'm looking for advice on the best way to use NASA's SRTM data to produce a
filled contour plot. I've been tinkering with this over the past week or so, and
I think I'm almost there, but there are still a couple of roadblocks.

So far, I've been using a small, 7KB file of SRTM data that's in bil format.
Basically the commands that I run are:
x<-readGDAL('./44193054/44193054/44193054.bil')
contour(x, drawlabels=FALSE, col=1:5)

This produces a contour plot of the data, but there's still a couple of
problems: 1) The contours aren't filled. If I try filled.contour(), the function
complains about the format of x. I get the error "Non-numeric argument to
mathematical function". I haven't figured out how to extract the relevant data
from x and pass it to filled.contour(). 2) If I use a larger file, I quickly run
into memory problems. I haven't found the exact filesize where this occurs, but
I'd like to be able to use data files that are at least 80MB in size. Do I need
to break the files into smaller chunks, or is there another way?

So my questions are: 1) How can I create a filled contour plot of the data? 2)
How should I get around the memory problem? 

I'm an amateur with very little experience with the sp package or mapping in
general (but I do have experience with R), so I may be making some basic
mistakes. For example, I'm not sure I'm using the best data format, and I know
there are others available. I'm hoping that I'm trying to do something that's
very common and that there's an easy solution. Any help would be greatly
appreciated.

Thanks,
Ian




More information about the R-sig-Geo mailing list