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

Tim Appelhans tim.appelhans at gmail.com
Fri Jul 24 13:42:32 CEST 2015



On 24.07.2015 13:29, Agustin Diez Castillo wrote:
> I’m getting an error when testing
>
> error: 'colour_ramp' is not an exported object from 'namespace:scales'

This is strange as 'colour_ramp' is an exported object from 
'namespace:scales' as can be seen here

https://github.com/cran/scales/blob/master/NAMESPACE

This function is used by leaflet

https://github.com/cran/leaflet/blob/master/R/colors.R

I do not get this error, my sessionInfo() is

R version 3.2.1 (2015-06-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.2 LTS

locale:
  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C LC_TIME=de_DE.UTF-8        
LC_COLLATE=en_US.UTF-8
  [5] LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=en_US.UTF-8 
LC_PAPER=de_DE.UTF-8       LC_NAME=C
  [9] LC_ADDRESS=C               LC_TELEPHONE=C 
LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C

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 leaflet_1.0.0.9999

loaded via a namespace (and not attached):
  [1] htmlwidgets_0.5.1 colorspace_1.2-6  scales_0.2.5 plyr_1.8.3        
magrittr_1.5      htmltools_0.2.6
  [7] tools_3.2.1       Rcpp_0.11.6       grid_3.2.1 digest_0.6.8      
munsell_0.4.2     lattice_0.20-33

which suggests I am using the same version of scales as you are...

I really am not sure what is happening here.

>
>  From the help page
> data(meuse.grid)
> coordinates(meuse.grid) = ~x+y
> proj4string(meuse.grid) <- CRS("+init=epsg:28992")
> gridded(meuse.grid) = TRUE
> meuse_rst <- stack(meuse.grid)
> m1 <- mapView(meuse_rst)
>
> sessionInfo()
> R version 3.1.3 (2015-03-09)
> Platform: x86_64-apple-darwin10.8.0 (64-bit)
> Running under: OS X 10.9.5 (Mavericks)
>
> 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] leaflet_1.0.0       Rsenal_0.1.81       colorspace_1.2-6    automap_1.0-14      scales_0.2.5        outliers_0.14       spatstat_1.41-1     foreign_0.8-63
>   [9] plyr_1.8.1          rasterVis_0.35      latticeExtra_0.6-26 RColorBrewer_1.1-2  data.table_1.9.4    Bchron_4.1.1        inline_0.3.14       raster_2.3-40
> [17] rgeos_0.3-8         rgdal_0.9-2         lattice_0.20-31     ggplot2_1.0.1       devtools_1.7.0      spdep_0.5-88        Matrix_1.2-0        sp_1.0-17
>
> loaded via a namespace (and not attached):
>   [1] abind_1.4-3      bitops_1.0-6     boot_1.3-16      chron_2.3-45     coda_0.17-1      deldir_0.1-9     digest_0.6.8     ellipse_0.3-8    FNN_1.1          goftest_1.0-2
> [11] grid_3.1.3       gstat_1.0-22     gtable_0.1.2     hdrcde_3.1       hexbin_1.27.0    htmltools_0.2.6  htmlwidgets_0.5  httr_0.6.1       intervals_0.15.0 LearnBayes_2.15
> [21] magrittr_1.5     MASS_7.3-40      mclust_5.0.0     mgcv_1.8-6       munsell_0.4.2    nlme_3.1-120     polyclip_1.3-0   proto_0.3-10     Rcpp_0.11.5      RCurl_1.95-4.5
> [31] reshape_0.8.5    reshape2_1.4.1   spacetime_1.1-3  splines_3.1.3    stringr_0.6.2    tensor_1.5       tools_3.1.3      xts_0.9-7        zoo_1.7-12
>
> On 24Jul, 2015, at 1:20 PM, Tim Appelhans <tim.appelhans at gmail.com> wrote:
>
>>
>> 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
>>
>>> 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
>>>
>> --
>> #####################################
>> Tim Appelhans
>> Department of Geography
>> Environmental Informatics
>> Philipps Universität Marburg
>> Deutschhausstraße 12
>> 35032 Marburg (Paketpost: 35037 Marburg)
>> Germany
>>
>> Tel +49 (0) 6421 28-25957
>>
>> http://environmentalinformatics-marburg.de/
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
#####################################
Tim Appelhans
Department of Geography
Environmental Informatics
Philipps Universität Marburg
Deutschhausstraße 12
35032 Marburg (Paketpost: 35037 Marburg)
Germany

Tel +49 (0) 6421 28-25957

http://environmentalinformatics-marburg.de/



More information about the R-sig-Geo mailing list