Thanks.
The example with an spatial polygons DF in p. 159 of
http://journal.r-project.org/archive/2013-1/kahle-wickham.pdf
works nicely.
Instead, fortify() refuses processing spatial poins or pixels DF
with an error:
Error: ggplot2 doesn't know how to deal with data of class
On 12/10/2013 09:38 AM, Agustin Lobo wrote:
Thanks.
The example with an spatial polygons DF in p. 159 of
http://journal.r-project.org/archive/2013-1/kahle-wickham.pdf
works nicely.
Instead, fortify() refuses processing spatial poins or pixels DF
with an error:
Error: ggplot2 doesn't
and would it possible a similar plot using contourplot() (or
levelplot()) overlaid
on a gmap?
I've tried the equivalent to the
stamen.R function that you refer to:
contourplot(rinvmod2goog,zscaleLog=TRUE,
at=my.at,colorkey=myColorkey,margin=FALSE,add=TRUE) +
It works for me using rinvmod2lonlat (long-lat coordinates).
Oscar.
-
Oscar Perpiñán Lamigueiro
Grupo de Sistemas Fotovoltaicos (IES-UPM)
Dpto. Ingeniería Eléctrica (ETSIDI-UPM)
URL: http://oscarperpinan.github.io
Twitter:
Hi,
spplot for SpatialPixelsDataFrame is built upon lattice::levelplot.
Thus, you can use most of its arguments in spplot. For your problem
you have to set contour=TRUE and region=FALSE. Moreover, you can
customize the labels with (surprise!) labels. This is documented in
the help page of
Yes, it does for me as well: I had messed with the parameters of the
map in the original function.
Here I've made a page showing what I do and what I get:
https://dl.dropboxusercontent.com/u/3180464/contourOngmap_log.html
Is it possible doing the reverse, overlaying the contour on top of the
map
Try this:
rinvmod2Ext - extend(rinvmod2lonlat,
with(bbMap2, c(ll.lon, ur.lon, ll.lat, ur.lat)))
contourplot(rinvmod2Ext, zscaleLog=TRUE, margin=FALSE) +
layer(grid.raster(gmap2,
x=lonCenter2, y=latCenter2,
width=width2,
Yes!
I also noticed that making a custom box for the plot is not
straightforward because
the user cannot set the box in get_map. I've managed to do it using
the extend() trick.
html updated
https://dl.dropboxusercontent.com/u/3180464/contourOngmap_log.html
Thanks!
Agus
On Tue, Dec 10, 2013 at
Maybe too obvious to be useful, but have you tried using the akima
package for plotting your variable?
It only needs the coordinates and the value of your variable:
require(akima)
data(akima)
## linear interpolation
akima.li - interp(akima$x, akima$y, akima$z)
image
I have the same problem: saving an unprojected raster as a .tif raises an
error. To complete what Guillaume said:
library(raster)
# Fail :
writeRaster(raster(matrix(1, 1, 1)), filename = test.tif)
# But,
writeRaster(raster(matrix(1, 1, 1)), filename = test.grd)
# And
r = raster()
values(r) = 1
Hello,
I want to construct home ranges by the CharHull-function in
adehabitatHR (CharHull {adehabitatHR} - Estimation of the Home Range by
Delaunay Triangulation method).
The Description says that I could select a given percentage of the
smallest triangles (measured by their area) as the
I wish to clip SpatialPolygonsDataFrames with a SpatialPolygonsDataFrame and
return a SpatialPolygonsDataFrames with new clipped boundaries and with data
from the source SpatialPolygonsDataFrames.
[The ArcGIS equivalent is:
Tony--
rgeos::gIntersection() can do what you want. I use it often to clip
vegetation map SpatialPolygonsDataFrames by park boundaries, retaining the
attributes of the veg map polygons.
Tips:
byid=c(TRUE,FALSE)
retains the polygon ids of the first SpatialPolygonsDataFrame in the
returned
Thank you Tom!
I tried the rgeos::gIntersection() approach on a quad dual core Windows 7
workstation, but found that it choked on a TopologyException after running
for over 10 minutes.
The raster approach to the problem produced a clean result in 77 seconds,
requiring under a single day of
Thanks Agus Camacho,
but this is essentially what I was doing: create a raster (an image is
a raster) out of the points
and then use contour() or the more sophisticated
rasterVis::contourplot or levelplot. In this
particular case the raster can be created with no interpolation, as
the points are
15 matches
Mail list logo