[R-sig-Geo] generate & plot elevation contour lines

karl.sommer at dpi.vic.gov.au karl.sommer at dpi.vic.gov.au
Thu Jun 29 01:37:03 CEST 2006

|         |           e.pebesma at geo.uu.|
|         |           nl               |
|         |                            |
|         |           27/06/2006 19:12 |
|         |                            |
  |                                                                                                                              |
  |       To:       karl.sommer at dpi.vic.gov.au                                                                                   |
  |       cc:       r-sig-geo at stat.math.ethz.ch                                                                                  |
  |       Subject:  Re: [R-sig-Geo]  generate & plot elevation contour lines                                                     |

karl.sommer at dpi.vic.gov.au wrote:
> my understanding is that adding the "contour = TRUE" will add the contour
> lines for kriged zinc concentration in the present example.
> However, what I am after is to superimpose contour lines of elevation in
> meters above sea level on top of an interpolated variable that is not
> elevation, eg zinc concentration or some other variable.
> I have interpolated maps of an electromagnetic survey  (EM38) of a field
> and I would like to overlay a plot of contour lines to visualize surface
> drainage patterns.
In that case you could pass them as a SpatialLinesDataFrame
object in the sp.layout list. It will not automatically print the
contour values, but you may be able to use colour; the corresponding
legend will be the next issue, then.

I have tried unsuccessfully to generate a SpatialLinesDataFrame object for
passing in sp.layout

I was trying to use the contourLines() function without success, probably I
didn't get the syntax right

I tried to use the function on an object of class SpatialPixelsDataFrame
(topo.idw) which I generated from a set of  elevation measurements
[1] "SpatialPixelsDataFrame"
[1] "sp"

running the function contourLines() directly I get the following error
> contourLines(topo.idw["var1.pred"])
Error in contourLines(topo.idw["var1.pred"]) :
      no proper 'z' matrix specified

running the function contour(topo.idw["var1.pred"]) I get a correct plot of
the contour lines

when I am trying to combine contourLines2SLDF() and contour() I get the
following error message
> CL <- contourLines2SLDF(contour(topo.idw["var1.pred"]))
Error in contourLines2SLDF(contour(topo.idw["var1.pred"])) :
      cL too short

I am not sure how to progress from here



More information about the R-sig-Geo mailing list