pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<legend id='sWFNP'><style id='sWFNP'><dir id='sWFNP'><q id='sWFNP'></q></dir></style></legend>
  • <small id='sWFNP'></small><noframes id='sWFNP'>

      <bdo id='sWFNP'></bdo><ul id='sWFNP'></ul>

    <tfoot id='sWFNP'></tfoot>

        <i id='sWFNP'><tr id='sWFNP'><dt id='sWFNP'><q id='sWFNP'><span id='sWFNP'><b id='sWFNP'><form id='sWFNP'><ins id='sWFNP'></ins><ul id='sWFNP'></ul><sub id='sWFNP'></sub></form><legend id='sWFNP'></legend><bdo id='sWFNP'><pre id='sWFNP'><center id='sWFNP'></center></pre></bdo></b><th id='sWFNP'></th></span></q></dt></tr></i><div class="us4eegw" id='sWFNP'><tfoot id='sWFNP'></tfoot><dl id='sWFNP'><fieldset id='sWFNP'></fieldset></dl></div>
      1. markercluster 是否與 LeafletProxy() 和選項 iconCreateFu

        Does markercluster work together with leafletProxy() and option iconCreateFunction?(markercluster 是否與 LeafletProxy() 和選項 iconCreateFunction 一起使用?)

            <legend id='YeYRN'><style id='YeYRN'><dir id='YeYRN'><q id='YeYRN'></q></dir></style></legend>
          1. <i id='YeYRN'><tr id='YeYRN'><dt id='YeYRN'><q id='YeYRN'><span id='YeYRN'><b id='YeYRN'><form id='YeYRN'><ins id='YeYRN'></ins><ul id='YeYRN'></ul><sub id='YeYRN'></sub></form><legend id='YeYRN'></legend><bdo id='YeYRN'><pre id='YeYRN'><center id='YeYRN'></center></pre></bdo></b><th id='YeYRN'></th></span></q></dt></tr></i><div class="kykue4q" id='YeYRN'><tfoot id='YeYRN'></tfoot><dl id='YeYRN'><fieldset id='YeYRN'></fieldset></dl></div>

              • <tfoot id='YeYRN'></tfoot>

                <small id='YeYRN'></small><noframes id='YeYRN'>

                  <tbody id='YeYRN'></tbody>
                  <bdo id='YeYRN'></bdo><ul id='YeYRN'></ul>
                  本文介紹了markercluster 是否與 LeafletProxy() 和選項 iconCreateFunction 一起使用?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我做錯了什么,或者為什么下面的例子不起作用?我正在嘗試使用選項 iconCreateFunction 使 Leaflet markercluster 插件在 R Shiny 應用程序中與 leafletProxy() 一起使用.插件是否無法使用 leafletProxy() 向地圖添加自定義圖標標記?

                  當我按下第一個按鈕并在下面的示例中縮小時,我收到一條錯誤消息:

                  <塊引用>

                  TypeError: this._group.options.iconCreateFunction 不是函數

                  我嘗試從 markercluster 復制

                  解決方案

                  修改方案

                  iconCreateFunction 的行為在 leafletProxy 中使用時絕對是 flakey.雖然我認為某些瀏覽器中存在緩存,因此難以直觀地跟蹤.

                  為了消除您遇到的 javascript 錯誤,應用 layerIdclusterId 值以及使用 removeMarker 代替 clearMarkers.

                  <塊引用>

                  注意我的解決方案的一個奇怪的副作用是重新繪制時會掉下一個標記,我有點累了,稍后再看看.這個問題可能是微不足道的,也可能不是微不足道的.

                  app.R

                  庫(閃亮)圖書館(dplyr)圖書館(傳單)ui <-流體頁面(titlePanel("你好閃亮!"),側邊欄布局(側邊欄面板(actionButton(inputId = "my_button1",label = "使用leafletProxy()"),actionButton(inputId = "my_button2",label = "使用 renderLeaflet()")),主面板(傳單輸出(outputId = "我的地圖",寬度 = "100%",高度 = "300 像素"))))服務器 <- 功能(輸入,輸出,會話){some_data <- data.frame(lon = c(4.905167, 4.906357, 4.905831),緯度 = c(52.37712, 52.37783, 52.37755),number_var = c(5, 9, 7),名稱 = c(簡"、哈羅德"、邁克")、字符串AsFactors = FALSE)marker_js <- JS("函數(簇){var html = '<div 樣式="背景色:rgba(77,77,77,0.5)"><span>'+ cluster.getChildCount() + '</div><span>'return new L.DivIcon({html: html, className: 'marker-cluster'});}")output$mymap <- renderLeaflet({傳單(一些數據)%>%addProviderTiles(providers$CartoDB.Positron) %>%適合邊界(?分鐘(經度),?分鐘(緯度),?最大(經度),?最大(緯度))%>%添加標記(layerId = "我的圖層",clusterId = "我的集群",lng = ~lon,緯度=?緯度,clusterOptions = markerClusterOptions(iconCreateFunction = marker_js))})觀察事件(輸入$my_button1,{leafletProxy("mymap", data = some_data) %>%removeMarker(layerId = "mylayer") %>%清除瓷磚 %>%addProviderTiles(providers$CartoDB.Positron) %>%適合邊界(?分鐘(經度),?分鐘(緯度),?最大(經度),?最大(緯度))%>%添加標記(layerId = "我的圖層",clusterId = "我的集群",lng = ~lon,緯度=?緯度,clusterOptions = markerClusterOptions(iconCreateFunction = marker_js))})觀察事件(輸入$my_button2,{output$mymap <- renderLeaflet({傳單(一些數據)%>%addProviderTiles(providers$CartoDB.Positron) %>%適合邊界(?分鐘(經度),?分鐘(緯度),?最大(經度),?最大(緯度))%>%添加標記(layerId = "我的圖層",clusterId = "我的集群",lng = ~lon,緯度=?緯度,clusterOptions = markerClusterOptions(iconCreateFunction = marker_js))})})}閃亮應用(用戶界面 = 用戶界面,服務器 = 服務器)

                  瀏覽器內

                  <塊引用>

                  沒有發現其他 javascript 錯誤.

                  Am I doing something wrong, or why does the below example not work? I am trying to make leaflet markercluster plugin work with leafletProxy() in an R Shiny app, using the option iconCreateFunction. Is the plugin not capable of adding customized icon markers to the map using leafletProxy()?

                  When I press the first button and zoom out in below example, I get an error saying:

                  TypeError: this._group.options.iconCreateFunction is not a function

                  I tried to copy the original example from the markercluster documentation:

                  library(shiny)
                  library(dplyr)
                  library(leaflet)
                  
                  ui <- fluidPage(
                    titlePanel("Hello Shiny!"),
                    sidebarLayout(
                      sidebarPanel(
                        actionButton(inputId = "my_button1",
                                     label = "Use leafletProxy()"),
                        actionButton(inputId = "my_button2",
                                     label = "Use renderLeaflet()")
                      ),
                      mainPanel(
                        leafletOutput(
                          outputId = "map",
                          width = "100%",
                          height = "300px"
                        )
                      )
                    )
                  )
                  
                  server <- function(input, output, session) {
                  
                    some_data <- data.frame(
                      "lon"=c(4.905167,4.906357,4.905831),
                      "lat"=c(52.37712,52.37783,52.37755),
                      "number_var"=c(5,9,7),
                      "name"=c("Jane","Harold","Mike"),
                      stringsAsFactors = F
                    )
                  
                    output$map <- renderLeaflet({
                      return(
                        leaflet(data = some_data[0,]) %>%
                           addProviderTiles(providers$CartoDB.Positron) %>%
                          fitBounds(
                            min(some_data$lon),
                            min(some_data$lat),
                            max(some_data$lon),
                            max(some_data$lat)
                          ) %>%
                          addMarkers(
                            lng = ~lon,
                            lat = ~lat,
                            clusterOptions = markerClusterOptions(
                              iconCreateFunction = JS(paste0("function(cluster) {",
                                                             "return new L.DivIcon({",
                                                             "html: '<div style="background-color:rgba(77,77,77,0.5)"><span>' + cluster.getChildCount() + '</div><span>',",
                                                             "className: 'marker-cluster'",
                                                             "});",
                                                             "}"))
                  
                  
                  
                            )
                          )
                      )
                    })
                  
                    observeEvent(input$my_button1,{
                        leafletProxy(mapId = "map",
                                     session = session,
                                     data = some_data) %>%
                          addProviderTiles(providers$CartoDB.Positron) %>%
                          clearMarkerClusters() %>%
                          clearMarkers() %>%
                          fitBounds(
                            min(some_data$lon),
                            min(some_data$lat),
                            max(some_data$lon),
                            max(some_data$lat)
                          ) %>%
                          addMarkers(
                            lng = ~lon,
                            lat = ~lat,
                            clusterOptions = markerClusterOptions(
                              iconCreateFunction = JS(paste0("function(cluster) {",
                                                             "console.log('Here comes cluster',cluster); ",
                                                             "return new L.DivIcon({",
                                                             "html: '<div style="background-color:rgba(77,77,77,0.5)"><span>' + cluster.getChildCount() + '</div><span>',",
                                                             "className: 'marker-cluster'",
                                                             "});",
                                                             "}"))
                            )
                          )
                    })
                  
                    observeEvent(input$my_button2,{
                      output$map <- renderLeaflet({
                  
                        leaflet(data = some_data) %>%
                          addProviderTiles(providers$CartoDB.Positron) %>%
                          fitBounds(
                            min(some_data$lon),
                            min(some_data$lat),
                            max(some_data$lon),
                            max(some_data$lat)
                          ) %>%
                          addMarkers(
                            lng = ~lon,
                            lat = ~lat,
                            clusterOptions = markerClusterOptions(
                              iconCreateFunction = JS(paste0("function(cluster) {",
                                                             "console.log('Here comes cluster',cluster); ",
                                                             "return new L.DivIcon({",
                                                             "html: '<div style="background-color:rgba(77,77,77,0.5)"><span>' + cluster.getChildCount() + '</div><span>',",
                                                             "className: 'marker-cluster'",
                                                             "});",
                                                             "}"))
                            )
                          )
                      })
                    })
                  }
                  
                  shinyApp(ui = ui, server = server)
                  

                  Package versions:

                  dplyr_0.7.4
                  leaflet_1.1.0
                  shiny_1.0.5
                  R version 3.4.3 (2017-11-30)
                  Platform: x86_64-pc-linux-gnu (64-bit)
                  Running under: Ubuntu 16.04.3 LTS
                  

                  Browser version: Firefox Quantum 57.0.1 (64-bit)

                  解決方案

                  Revised solution

                  The behaviour of iconCreateFunction is definitely flakey when used within leafletProxy. Although I think there is caching in some browsers making it difficult to track visually.

                  In order to eliminate the javascript error you were experiencing, it is important to apply layerId and clusterId values as well as using removeMarker in lieu of clearMarkers.

                  N.B. A strange side-effect of my solution is that a marker is dropped when re-drawn, I'm getting a bit tired and will have another look later. That problem may or may not be trivial.

                  app.R

                  library(shiny)
                  library(dplyr)
                  library(leaflet)
                  
                  ui <- fluidPage(
                    titlePanel("Hello Shiny!"),
                    sidebarLayout(
                      sidebarPanel(
                        actionButton(inputId = "my_button1",
                                     label = "Use leafletProxy()"),
                        actionButton(inputId = "my_button2",
                                     label = "Use renderLeaflet()")
                      ),
                      mainPanel(
                        leafletOutput(
                          outputId = "mymap",
                          width = "100%",
                          height = "300px"
                      ))
                  ))
                  
                  server <- function(input, output, session) {
                  
                    some_data <- data.frame(
                      lon = c(4.905167, 4.906357, 4.905831),
                      lat = c(52.37712, 52.37783, 52.37755),
                      number_var = c(5, 9, 7),
                      name = c("Jane", "Harold", "Mike"),
                      stringsAsFactors = FALSE
                    )
                  
                    marker_js <- JS("function(cluster) {
                                    var html = '<div style="background-color:rgba(77,77,77,0.5)"><span>' + cluster.getChildCount() + '</div><span>'
                                    return new L.DivIcon({html: html, className: 'marker-cluster'});
                                    }")
                  
                    output$mymap <- renderLeaflet({
                  
                      leaflet(some_data) %>%
                        addProviderTiles(providers$CartoDB.Positron) %>%
                        fitBounds(
                          ~min(lon),
                          ~min(lat),
                          ~max(lon),
                          ~max(lat)
                        ) %>%
                        addMarkers(
                          layerId = "mylayer",
                          clusterId = "mycluster",
                          lng = ~lon,
                          lat = ~lat,
                          clusterOptions = markerClusterOptions(
                            iconCreateFunction = marker_js
                          )
                        )
                  
                    })
                  
                    observeEvent(input$my_button1, {
                  
                      leafletProxy("mymap", data = some_data) %>%
                        removeMarker(layerId = "mylayer") %>%
                        clearTiles %>%
                        addProviderTiles(providers$CartoDB.Positron) %>%
                        fitBounds(
                          ~min(lon),
                          ~min(lat),
                          ~max(lon),
                          ~max(lat)
                        ) %>%
                        addMarkers(
                          layerId = "mylayer",
                          clusterId = "mycluster",
                          lng = ~lon,
                          lat = ~lat,
                          clusterOptions = markerClusterOptions(
                            iconCreateFunction = marker_js
                          )
                        )
                  
                    })
                  
                    observeEvent(input$my_button2,{
                  
                      output$mymap <- renderLeaflet({
                  
                        leaflet(some_data) %>%
                          addProviderTiles(providers$CartoDB.Positron) %>%
                          fitBounds(
                            ~min(lon),
                            ~min(lat),
                            ~max(lon),
                            ~max(lat)
                          ) %>%
                          addMarkers(
                            layerId = "mylayer",
                            clusterId = "mycluster",
                            lng = ~lon,
                            lat = ~lat,
                            clusterOptions = markerClusterOptions(
                              iconCreateFunction = marker_js
                            )
                          )
                      })
                  
                    })
                  
                  }
                  
                  shinyApp(ui = ui, server = server)
                  

                  in-browser

                  No other javascript errors were noted.

                  這篇關于markercluster 是否與 LeafletProxy() 和選項 iconCreateFunction 一起使用?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Check if a polygon point is inside another in leaflet(檢查一個多邊形點是否在傳單中的另一個內部)
                  Changing leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改傳單標記群集圖標顏色,繼承其余默認 CSS 屬性)
                  Trigger click on leaflet marker(觸發點擊傳單標記)
                  How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默認加載磁貼顏色?)
                  Adding Leaflet layer control to sidebar(將 Leaflet 圖層控件添加到側邊欄)
                  Leaflet - get latitude and longitude of a marker inside a pop-up(Leaflet - 在彈出窗口中獲取標記的緯度和經度)
                  <legend id='LHHRK'><style id='LHHRK'><dir id='LHHRK'><q id='LHHRK'></q></dir></style></legend>
                    <bdo id='LHHRK'></bdo><ul id='LHHRK'></ul>
                      • <tfoot id='LHHRK'></tfoot>

                            <tbody id='LHHRK'></tbody>
                          <i id='LHHRK'><tr id='LHHRK'><dt id='LHHRK'><q id='LHHRK'><span id='LHHRK'><b id='LHHRK'><form id='LHHRK'><ins id='LHHRK'></ins><ul id='LHHRK'></ul><sub id='LHHRK'></sub></form><legend id='LHHRK'></legend><bdo id='LHHRK'><pre id='LHHRK'><center id='LHHRK'></center></pre></bdo></b><th id='LHHRK'></th></span></q></dt></tr></i><div class="coiqwso" id='LHHRK'><tfoot id='LHHRK'></tfoot><dl id='LHHRK'><fieldset id='LHHRK'></fieldset></dl></div>

                          1. <small id='LHHRK'></small><noframes id='LHHRK'>

                            主站蜘蛛池模板: 塑胶跑道_学校塑胶跑道_塑胶球场_运动场材料厂家_中国塑胶跑道十大生产厂家_混合型塑胶跑道_透气型塑胶跑道-广东绿晨体育设施有限公司 | 河南mpp电力管_mpp电力管生产厂家_mpp电力电缆保护管价格 - 河南晨翀实业 | NMRV减速机|铝合金减速机|蜗轮蜗杆减速机|NMRV减速机厂家-东莞市台机减速机有限公司 | 合同书格式和范文_合同书样本模板_电子版合同,找范文吧 | 不锈钢监控杆_监控立杆厂家-廊坊耀星光电科技有限公司 | 无锡门窗-系统门窗-阳光房-封阳台-断桥铝门窗厂[窗致美] | 电气控制系统集成商-PLC控制柜变频控制柜-非标自动化定制-电气控制柜成套-NIDEC CT变频器-威肯自动化控制 | 包装机_厂家_价格-山东包装机有限公司 | 丽陂特官网_手机信号屏蔽器_Wifi信号干扰器厂家_学校考场工厂会议室屏蔽仪 | 焊锡丝|焊锡条|无铅锡条|无铅锡丝|无铅焊锡线|低温锡膏-深圳市川崎锡业科技有限公司 | 低压载波电能表-单相导轨式电能表-华邦电力科技股份有限公司-智能物联网综合管理平台 | 丹佛斯压力传感器,WISE温度传感器,WISE压力开关,丹佛斯温度开关-上海力笙工业设备有限公司 | 磁力链接搜索神器_BT磁力狗_CILIMAO磁力猫_高效磁力搜索引擎2024 | 桨叶搅拌机_螺旋挤压/方盒旋切造粒机厂家-无锡市鸿诚输送机械有限公司 | HEYL硬度计量泵-荧光法在线溶解氧仪-净时测控技术(上海)有限公司 | 溶氧传感器-pH传感器|哈美顿(hamilton) | 冷油器-冷油器换管改造-连云港灵动列管式冷油器生产厂家 | 上海租奔驰_上海租商务车_上海租车网-矢昂汽车服务公司 | 扬子叉车厂家_升降平台_电动搬运车|堆高车-扬子仓储叉车官网 | 电位器_轻触开关_USB连接器_广东精密龙电子科技有限公司 | 吉祥新世纪铝塑板_生产铝塑板厂家_铝塑板生产厂家_临沂市兴达铝塑装饰材料有限公司 | 【MBA备考网】-2024年工商管理硕士MBA院校/报考条件/培训/考试科目/提前面试/考试/学费-MBA备考网 | 钢绞线万能材料试验机-全自动恒应力两用机-混凝土恒应力压力试验机-北京科达京威科技发展有限公司 | LHH药品稳定性试验箱-BPS系列恒温恒湿箱-意大利超低温冰箱-上海一恒科学仪器有限公司 | 面粉仓_储酒罐_不锈钢储酒罐厂家-泰安鑫佳机械制造有限公司 | 工业PH计|工业ph酸度计|在线PH计价格-合肥卓尔仪器仪表有限公司 济南画室培训-美术高考培训-山东艺霖艺术培训画室 | 金蝶帐无忧|云代账软件|智能财税软件|会计代账公司专用软件 | 不锈钢酒柜|恒温酒柜|酒柜定制|酒窖定制-上海啸瑞实业有限公司 | 洛阳防爆合格证办理-洛阳防爆认证机构-洛阳申请国家防爆合格证-洛阳本安防爆认证代办-洛阳沪南抚防爆电气技术服务有限公司 | 骨密度仪-骨密度测定仪-超声骨密度仪-骨龄测定仪-天津开发区圣鸿医疗器械有限公司 | 耐破强度测试仪-纸箱破裂强度试验机-济南三泉中石单品站 | 离子色谱自动进样器-青岛艾力析实验科技有限公司 | 回收二手冲床_金丰旧冲床回收_协易冲床回收 - 大鑫机械设备 | 玻璃钢板-玻璃钢防腐瓦-玻璃钢材料-广东壹诺 | 餐饮小吃技术培训-火锅串串香培训「何小胖培训」_成都点石成金[官网] | 青岛球场围网,青岛车间隔离网,青岛机器人围栏,青岛水源地围网,青岛围网,青岛隔离栅-青岛晟腾金属制品有限公司 | 砂石生产线_石料生产线设备_制砂生产线设备价格_生产厂家-河南中誉鼎力智能装备有限公司 | 湿地保护| 大功率金属激光焊接机价格_不锈钢汽车配件|光纤自动激光焊接机设备-东莞市正信激光科技有限公司 定制奶茶纸杯_定制豆浆杯_广东纸杯厂_[绿保佳]一家专业生产纸杯碗的厂家 | 钢格板|镀锌钢格板|热镀锌钢格板|格栅板|钢格板|钢格栅板|热浸锌钢格板|平台钢格板|镀锌钢格栅板|热镀锌钢格栅板|平台钢格栅板|不锈钢钢格栅板 - 专业钢格板厂家 | 工程管道/塑料管材/pvc排水管/ppr给水管/pe双壁波纹管等品牌管材批发厂家-河南洁尔康建材 |