R小叶addWMStiles与投影(R leaflet addWMStiles with projection)

编程入门 行业动态 更新时间:2024-10-25 12:26:35
R小叶addWMStiles与投影(R leaflet addWMStiles with projection)

我试图遵循这个例子: 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.

更多推荐

本文发布于:2023-08-07 17:33:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465124.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:小叶   addWMStiles   projection   leaflet

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!