[R-sig-Geo] Help needed with spplot

Dylan Beaudette debeaudette at ucdavis.edu
Tue Apr 13 22:03:59 CEST 2010


On Tuesday 13 April 2010, Thomas Adams wrote:
> All:
>
> I'm using GRASS 6.4 with R 2.9.2 and sp/spgrass6. When plotting a vector
> file, read in from GRASS, using spplot, the drawing takes many minutes
> to complete. Apart from the fact that the vector file is probably more
> detailed than I need, I know time is spent drawing off-screen. I tried
> specifying xlim & ylim, but, of course, this just zooms into the area
> I'm mapping, and does not solve my underlying problem.
>
> I also tried using pruneMap(), but this did not seem to make any
> difference in the length of time before my R prompt returned. By
> contrast, GRASS re-draws very fast, within a few seconds instead of ~5
> minutes. I want to use spplot to draw an array of maps (21), so 1+ hours
> will not work for what I am doing.
>
> Any thoughts how I might speed-up the process?
>
> Regards,
> Tom

Hi Tom,

What kind of vector data are you plotting? Probably not points. If you are 
working with very detailed lines or polygons, I would suggest simplifying 
them in GRASS first. In GRASS 6.4, v.clean is the module of choice. If you 
can get GRASS 6.5, then v.generalize will work even better. Note that you 
need to work on boundaries with v.generalize, and too much "pruning" will 
result in broken topology.

I recently used an incantation like this:
v.generalize in=ca_counties out=ca_counties_simple type=boundary  
method=douglas_reduction threshold=1000

... to reduce the number of vertices in a map of CA counties, so that I could 
plot it with spplot().

Cheers,
Dylan

-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341



More information about the R-sig-Geo mailing list