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

Rainer M Krug Rainer at krugs.de
Fri Jul 24 14:01:27 CEST 2015


Tim Appelhans <tim.appelhans at gmail.com> writes:

> On 24.07.2015 13:13, Bernd Vogelgesang wrote:
>> Hi,
>>
>> can some one tell me how I can install this package?
>> Cloning and copying it to the R folder does not do it, installing in
>> from file wants to have a tar.gz.
>> I usually use RStudio.
>>
>> Thanx
>> Bernd
>>
>
> you can use library("devtools") for this. devtools is available on CRAN
>
> library("devtools")
> install_github("environmentalinformatics-marburg/Rsenal")
>
> That should do it

That installed it, but "leaflet" is not installed:

,----
| > library(Rsenal
| + )
| Loading required package: raster
| Loading required package: sp
| 
| Attaching package: ‘Rsenal’
| 
| The following object is masked from ‘package:raster’:
| 
|     addLayer
| 
| > data(meuse.grid)
| > coordinates(meuse.grid) = ~x+y
| > proj4string(meuse.grid) <- CRS("+init=epsg:28992")
| > gridded(meuse.grid) = TRUE
| > meuse_rst <- stack(meuse.grid)
| > mapView(meuse_rst[[3]])
| Error in loadNamespace(name) : there is no package called ‘leaflet’
| >
`----

After installing and loading leaflet, it works.

After that, "leaflet does not need to be loaded explicitly.

,----
| > sessionInfo()
| R version 3.2.1 (2015-06-18)
| Platform: x86_64-apple-darwin14.4.0 (64-bit)
| Running under: OS X 10.10.4 (Yosemite)
| 
| locale:
| [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
| 
| attached base packages:
| [1] stats     graphics  grDevices utils     datasets  methods   base
| 
| other attached packages:
| [1] Rsenal_0.1.81 raster_2.4-15 sp_1.1-1
| 
| loaded via a namespace (and not attached):
|  [1] Rcpp_0.11.6      lattice_0.20-31  png_0.1-7        digest_0.6.8
|  [5] grid_3.2.1       plyr_1.8.3       jsonlite_0.9.16  magrittr_1.5
|  [9] scales_0.2.5     leaflet_1.0.0    rgdal_1.0-4      tools_3.2.1
| [13] htmlwidgets_0.5  munsell_0.4.2    yaml_2.1.13      base64enc_0.1-2
| [17] colorspace_1.2-6 htmltools_0.2.6
| > version
|                _
| platform       x86_64-apple-darwin14.4.0
| arch           x86_64
| os             darwin14.4.0
| system         x86_64, darwin14.4.0
| status
| major          3
| minor          2.1
| year           2015
| month          06
| day            18
| svn rev        68531
| language       R
| version.string R version 3.2.1 (2015-06-18)
| nickname       World-Famous Astronaut
| >
`----

Cheers,

Rainer



Rainer
>
>>
>> Am 24.07.2015, 12:03 Uhr, schrieb Rainer M Krug <Rainer at krugs.de>:
>>
>>> Tim Appelhans <tim.appelhans at gmail.com> writes:
>>>
>>>> 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.
>>>
>>> This looks like something I was really missing! I was always exporting
>>> my spatial data into GRASS and viewing it there - but this looks really
>>> brilliant! This makes out of R a very powerful command line GIS.
>>>
>>> I would really like to see this functionality in a separate R package on
>>> CRAN - even with only its current functionality, it is very useful!
>>>
>>> Thanks a lot and keep us posted,
>>>
>>> Rainer
>>>
>>>> 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
>>>
>>
>>

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer at krugs.de

Skype:      RMkrug

PGP: 0x0F52F982
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 480 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20150724/79bff977/attachment.bin>


More information about the R-sig-Geo mailing list