Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"maximum number of pixels for Raster* viewing is #BEBEBE80" #111

Closed
johnbaums opened this issue Nov 8, 2017 · 3 comments
Closed

"maximum number of pixels for Raster* viewing is #BEBEBE80" #111

johnbaums opened this issue Nov 8, 2017 · 3 comments

Comments

@johnbaums
Copy link

When using mapview to render a raster, specifying native.crs=TRUE leads to the warning message:

Error in round(size) : non-numeric argument to mathematical function
In addition: Warning message:
In rasterCheckSize(x, maxpixels = maxpixels) :
  maximum number of pixels for Raster* viewing is #BEBEBE80 ; 
the supplied Raster* has 9 
 ... decreasing Raster* resolution to #BEBEBE80 pixels
 to view full resolution set 'maxpixels =  9 '

I see that native.crs is unsupported for raster objects (docs state "Currently only works for simple features."), but the warning message seems to have gone a bit haywire somewhere along the line.

Steps to reproduce:

r <- raster(matrix(1:9, 3))
mapview(r, legend=T, native.crs=TRUE)
@tim-salabim
Copy link
Member

tim-salabim commented Nov 8, 2017

This should work with the latest CRAN version.

screenshot at 2017-11-08 07 40 28

@johnbaums
Copy link
Author

I'm still seeing the warning:

install.packages('mapview')
library(mapview)
library(raster)

( r <- raster(matrix(1:9, 3)) )
## class       : RasterLayer 
## dimensions  : 3, 3, 9  (nrow, ncol, ncell)
## resolution  : 0.3333333, 0.3333333  (x, y)
## extent      : 0, 1, 0, 1  (xmin, xmax, ymin, ymax)
## coord. ref. : NA 
## data source : in memory
## names       : layer 
## values      : 1, 9  (min, max)

mapview(r, native.crs=TRUE)
## Error in round(size) : non-numeric argument to mathematical function
## In addition: Warning message:
## In rasterCheckSize(x, maxpixels = maxpixels) :
##   maximum number of pixels for Raster* viewing is #BEBEBE80 ; 
## the supplied Raster* has 9 
##  ... decreasing Raster* resolution to #BEBEBE80 pixels
##  to view full resolution set 'maxpixels =  9 '

Setting a crs on r doesn't change this.

btw: is the expected behaviour that plainview is deployed?

sessionInfo()
## R version 3.4.2 (2017-09-28)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows >= 8 x64 (build 9200)
## 
## Matrix products: default
## 
## locale:
## [1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252    LC_MONETARY=English_Australia.1252 LC_NUMERIC=C                      
## [5] LC_TIME=English_Australia.1252    
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] mapview_2.2.0 leaflet_1.1.0 raster_2.5-8  sp_1.2-5     
## 
## loaded via a namespace (and not attached):
##  [1] Rcpp_0.12.13      compiler_3.4.2    plyr_1.8.4        R.methodsS3_1.7.1 R.utils_2.5.0     base64enc_0.1-3   iterators_1.0.8   class_7.3-14     
##  [9] tools_3.4.2       gdalUtils_2.0.1.7 digest_0.6.12     satellite_1.0.1   lattice_0.20-35   viridisLite_0.2.0 png_0.1-7         foreach_1.4.3    
## [17] shiny_1.0.5       DBI_0.7           crosstalk_1.0.0   yaml_2.1.14       rgdal_1.2-13      e1071_1.6-8       htmlwidgets_0.9   webshot_0.4.2    
## [25] stats4_3.4.2      classInt_0.1-24   grid_3.4.2        sf_0.5-6          R6_2.2.2          udunits2_0.13     magrittr_1.5      scales_0.5.0     
## [33] codetools_0.2-15  htmltools_0.3.6   units_0.4-6       mime_0.5          xtable_1.8-2      colorspace_1.3-2  httpuv_1.3.5      munsell_0.4.3    
## [41] R.oo_1.21.0    

@tim-salabim
Copy link
Member

I was able to reproduce this issue on a windows machine. Strange that it didn't happen on linux... In any way, please reopen if this doesn't resolve the issue in your case.
Yes, it is intended that plainview is deployed when crs is NA or native.crs is TRUE. This is, however, hopefully only a temporary workaround until leaflet is upgraded to leafletjs 1.x so that Leaflet.CRS.Simple can handle raster images too, which currently (wrapping leafletjs 0.7) it can't. Also, I have been rather slack on raster support recently, but will soonish start to turn my efforts towards stars support. Let's see how that goes :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants