[R-sig-Geo] Plotting direction vectors from an aspect map
Oscar Perpiñan Lamigueiro
oscar.perpinan at upm.es
Sun Sep 18 18:02:02 CEST 2011
Hi,
I have uploaded a first draft of a vectorplot function in rasterVis. It
is available here:
https://r-forge.r-project.org/scm/viewvc.php/drafts/vectorplot.R?view=markup&root=rastervis.
It uses the raster::slopeAspect function to calculate the slope/aspect
from a raster object.
For example:
library(raster)
library(rasterVis)
df <- expand.grid(x=seq(-2, 2, .1), y=seq(-2, 2, .1))
df$z <- with(df, (3*x^2 + y)*exp(-x^2-y^2))
r1 <- rasterFromXYZ(df)
df$z <- with(df, x*exp(-x^2-y^2))
r2 <- rasterFromXYZ(df)
df$z <- with(df, y*exp(-x^2-y^2))
r3 <- rasterFromXYZ(df)
projection(r1) <- projection(r2) <- projection(r3) <-
CRS("+proj=longlat +datum=WGS84")
vectorplot(r1, par.settings=RdBuTheme)
vectorplot(r2, par.settings=RdBuTheme)
vectorplot(r3, par.settings=RdBuTheme)
I will include it in the rasterVis package after some tests.
Best,
Oscar.
-------------
Oscar Perpiñán Lamigueiro
Dpto. de Ingeniería Eléctrica
EUITI-UPM
http://procomun.wordpress.com
> >> > -----Original Message-----
> >> > From:r-sig-geo-bounces at r-project.org
> >> > [mailto:r-sig-geo-bounces at r- project.org] On Behalf Of Jonathan
> >> > Greenberg Sent: Thursday, September 15, 2011 7:18 PM
> >> > To: r-sig-geo
> >> > Subject: [R-sig-Geo] Plotting direction vectors from an aspect
> >> > map
> >> > R-sig-geo'ers:
> >> >
> >> > Given an aspect raster (GDAL-readable), is there a way to plot
> >> > the aspect image using arrows representing each cell's
> >> > direction? I'm assuming I have to convert the raster to a set
> >> > of points -- are there arrow symbols and, if so, can you rotate
> >> > them based on some parameter?
> >> > Thanks!
> >> >
> >> > --j
> >> >
> >> > --
> >> > Jonathan A. Greenberg, PhD
> >> > Assistant Project Scientist
> >> > Center for Spatial Technologies and Remote Sensing (CSTARS)
> >> > Department of Land, Air and Water Resources
> >> > University of California, Davis
> >> > One Shields Avenue
> >> > Davis, CA 95616
> >> > Phone: 415-763-5476
> >> > AIM: jgrn307, MSN:jgrn307 at hotmail.com, Gchat: jgrn307
> >> >
> >> > _______________________________________________
> >> > R-sig-Geo mailing list
> >> > R-sig-Geo at r-project.org
> >> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> > _______________________________________________
> > R-sig-Geo mailing list
> > R-sig-Geo at r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
More information about the R-sig-Geo
mailing list