我试图遵循这个例子: https ://rpubs.com/cyclemumner/228100,特别是添加了带有custum投影的wms tile的部分,但是当我运行代码时,我似乎没有获得wms tile。 我从github安装了传单。
if (!require('devtools')) install.packages('devtools') devtools::install_github('rstudio/leaflet')使用传单1.0.2.9010,R R-3.3.2和RStudio 1.0.136。
我运行的代码如下
library(leaflet) zoom <- 1 maxZoom <- 5 crsAntartica <- leafletCRS( crsClass = 'L.Proj.CRS', code = 'EPSG:3031', proj4def = '+proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs', resolutions = c(8192, 4096, 2048, 1024, 512, 256), origin = c(-4194304, 4194304), bounds = list( c(-4194304, -4194304), c(4194304, 4194304) ) ) leaflet(options= leafletOptions(crs=crsAntartica, minZoom = zoom, maxZoom=maxZoom, worldCopyJump = FALSE)) %>% setView(0, -90, 0) %>% addWMSTiles(baseUrl="https://maps.environments.aq/mapcache/antarc/?", layers="antarc_ramp_bath_shade_mask", options=WMSTileOptions(format="image/png",transparent=TRUE), attribution="xxx") %>% addGraticule()我得到的就是这个
关于我做错的任何想法?
I'm trying to follow this example: https://rpubs.com/cyclemumner/228100, especially the part where wms tiles with custum projection are added, but when I run the code I don't seem to get the wms tiles. I've installed leaflet from github.
if (!require('devtools')) install.packages('devtools') devtools::install_github('rstudio/leaflet')Using leaflet 1.0.2.9010,R R-3.3.2 and RStudio 1.0.136.
The code I run is the following
library(leaflet) zoom <- 1 maxZoom <- 5 crsAntartica <- leafletCRS( crsClass = 'L.Proj.CRS', code = 'EPSG:3031', proj4def = '+proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs', resolutions = c(8192, 4096, 2048, 1024, 512, 256), origin = c(-4194304, 4194304), bounds = list( c(-4194304, -4194304), c(4194304, 4194304) ) ) leaflet(options= leafletOptions(crs=crsAntartica, minZoom = zoom, maxZoom=maxZoom, worldCopyJump = FALSE)) %>% setView(0, -90, 0) %>% addWMSTiles(baseUrl="https://maps.environments.aq/mapcache/antarc/?", layers="antarc_ramp_bath_shade_mask", options=WMSTileOptions(format="image/png",transparent=TRUE), attribution="xxx") %>% addGraticule()What I get is this
Any ideas on what I'm doing wrong?
最满意答案
找到了我没有让它工作的原因。 在RStudio查看器中查看时,wms图块不会显示。 当我把代码放在我正在处理的闪亮应用程序中时,就会显示wms图块。
Found the reason why I didn't get it to work. The wms tiles don't show up when viewed in the RStudio viewer. When I put the code inside a shiny app i'm working on then the wms tiles appear.
更多推荐
发布评论