[R-sig-Geo] Use a PNG image as background for lattice plotting with rasterVis

Agustin Lobo alobolistas at gmail.com
Mon Dec 9 19:00:47 CET 2013


Is it possible to get just the contours on top of the gmap?
If I use levelplot(...,contour=TRUE,...) I get the contours but
the filled levels as well.
Thanks
Agus

On Sat, Oct 19, 2013 at 10:05 AM, Oscar Perpiñan
<oscar.perpinan at gmail.com> wrote:
> Hello,
>
> Let's suppose that 'gmap' is the image resulting from a GetMap.bbox() call
> and 'r' is your Raster*.  A suitable solution is:
>
> library(rasterVis)
>
> levelplot(r) + layer_(grid.raster(gmap,
>                                                              x=lonCenter,
> y=latCenter,
>                                                              width=width,
> height=height,
>
> default.units='native'))
>
> The 'lonCenter', 'latCenter', 'width' and 'height' parameters have to be
> extracted from the image attributes. In the next links you will find an
> example using ggmap (which is built upon RgoogleMaps). Between lines 17 and
> 25 you will find details to extract them:
>
> https://gist.github.com/oscarperpinan/5451682
> http://procomun.wordpress.com/2013/04/24/stamen-maps-with-spplot/
>
> Perhaps you will have to play with the 'alpha' values to mix the result of
> levelplot and grid.raster.
>
> Best,
>
> Oscar Perpiñán Lamigueiro
> Grupo de Sistemas Fotovoltaicos (IES-UPM)
> Dpto. Ingeniería Eléctrica (EUITI-UPM)
> URL: http://oscarperpinan.github.io
> Twitter: @oscarperpinan
> LinkedIn: http://es.linkedin.com/in/oscarperpinan
> El 18/10/2013 23:56, "Waichler, Scott R" <Scott.Waichler at pnnl.gov> escribió:
>
>> Hi,
>>
>> I've learned the basics of using RgoogleMaps and rasterVis, and now I want
>> to combine their capabilities to use levelplot() with a georeferenced PNG
>> image as a background in the lattice panel.  And, I want to plot to the
>> normal R graphics devices, not the web as package plotGoogleMaps does.  Can
>> anyone provide an example of how to use the result of RgoogleMaps'
>> GetMap.bbox() as a background image in a plot produced with the rasterVis
>> version of lattice graphics?
>>
>> Thanks,
>> Scott Waichler
>> Pacific Northwest National Laboratory
>> Richland, WA USA
>> scott.waichler at pnnl.gov
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
>         [[alternative HTML version deleted]]
>
>
> _______________________________________________
> 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