[R-sig-Geo] mapView: basic interactive viewing of spatial data in R

Edzer Pebesma edzer.pebesma at uni-muenster.de
Fri Jul 24 14:26:44 CEST 2015

Hi Tim, thanks for starting the discussion.

I started a similar discussion (off-list, with package maintainers) for
the case where google map or openstreetmap maps are used as background
in map plots created in R, support for which is now scattered over
ggmap::get_map, RgoogleMaps::GetMap, dismo::gmap and
https://github.com/hadley/rastermap. (on r-forge, sp::plot and
sp::spplot can now deal with these, see sp::demo(webmap)).

The (un)projection mapView does is towards epsg:4326 (longlat WGS84),
leaflet assumes this and takes care of the projection to web mercator;
the message printed in mapView (if verbose = TRUE) and your tutorial do
the correct thing but suggest they convert to mercator.

Some remaining questions:
- package leaflet also supports plotting Spatial* and Raster* objects,
what is exactly added by mapView?
- have you thought about integrating this functionality into the leaflet
R package?
- could we strive towards argument compatibility, so that we can get
things done by simply changing "plot" or "spplot" into "leaflet"?

On 07/24/2015 11:39 AM, Tim Appelhans wrote:
> Dear list members,
> I would like to draw your attention to a little 'project' I've been 
> working on over the past few weeks.
> Using leaflet for R, I have defined some methods for spatial data (e.g. 
> Raster*, Spatial* objects) to quickly visualise them in either the 
> RStudio Viewer pan or the default web browser. The function I created 
> for this is called mapView().
> Think of it as an interactive version of spplot()/plot() for spatial 
> data (though less versatile). It enables zooming, paning and basic layer 
> queries (i.e. printing of the attributes in the @data slot of Spatial* 
> objects + the x/y location of the feature). For Raster* objects queries 
> are currently not available as leaflet translates the data into RGB 
> values for display. Furthermore, background maps can be defined and 
> multiple different spatial object layers can be overlaid.
> At the moment mapView() lives in our Rsenal package on github 
> (https://github.com/environmentalinformatics-marburg/Rsenal) but this is 
> likely going to change at some point in the not too distant future. This 
> also depends on whether there is active interest in developping this 
> sort of thing further to provide more than the current admittedly rather 
> limited functionality. This, however, would involve JavaScript coding 
> which I do not have any experience with.
> A quick (non-interactive) intorduction can be found here:
> https://metvurst.wordpress.com/
> The full introductory article including interactive examples is 
> published here:
> http://environmentalinformatics-marburg.github.io/web-presentations/20150723_mapView.html
> I hope this may prove useful for some of you.
> Also, if anyone is keen to get involved in taking this further, please 
> let me know and we will see how to best proceed.
> Best,
> Tim

Edzer Pebesma
Institute for Geoinformatics (ifgi),  University of Münster,
Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 33081
Journal of Statistical Software:   http://www.jstatsoft.org/
Computers & Geosciences:   http://elsevier.com/locate/cageo/
Spatial Statistics Society http://www.spatialstatistics.info

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20150724/86f1d6c6/attachment.bin>

More information about the R-sig-Geo mailing list