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

  • <legend id='79NG5'><style id='79NG5'><dir id='79NG5'><q id='79NG5'></q></dir></style></legend>

    <small id='79NG5'></small><noframes id='79NG5'>

    <i id='79NG5'><tr id='79NG5'><dt id='79NG5'><q id='79NG5'><span id='79NG5'><b id='79NG5'><form id='79NG5'><ins id='79NG5'></ins><ul id='79NG5'></ul><sub id='79NG5'></sub></form><legend id='79NG5'></legend><bdo id='79NG5'><pre id='79NG5'><center id='79NG5'></center></pre></bdo></b><th id='79NG5'></th></span></q></dt></tr></i><div class="4cqmqk0" id='79NG5'><tfoot id='79NG5'></tfoot><dl id='79NG5'><fieldset id='79NG5'></fieldset></dl></div>
    <tfoot id='79NG5'></tfoot>
      <bdo id='79NG5'></bdo><ul id='79NG5'></ul>
      1. 僅當縮放級別&gt;時,才在閃亮的傳單地圖中顯

        Show layer in leaflet map in Shiny only when zoom level gt; 8 with LayersControl?(僅當縮放級別gt;時,才在閃亮的傳單地圖中顯示圖層8 層控制?)
        <i id='SysYj'><tr id='SysYj'><dt id='SysYj'><q id='SysYj'><span id='SysYj'><b id='SysYj'><form id='SysYj'><ins id='SysYj'></ins><ul id='SysYj'></ul><sub id='SysYj'></sub></form><legend id='SysYj'></legend><bdo id='SysYj'><pre id='SysYj'><center id='SysYj'></center></pre></bdo></b><th id='SysYj'></th></span></q></dt></tr></i><div class="o2u0wgq" id='SysYj'><tfoot id='SysYj'></tfoot><dl id='SysYj'><fieldset id='SysYj'></fieldset></dl></div>

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

      2. <legend id='SysYj'><style id='SysYj'><dir id='SysYj'><q id='SysYj'></q></dir></style></legend>
        <tfoot id='SysYj'></tfoot>

                <tbody id='SysYj'></tbody>
                <bdo id='SysYj'></bdo><ul id='SysYj'></ul>
                1. 本文介紹了僅當縮放級別&gt;時,才在閃亮的傳單地圖中顯示圖層8 層控制?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我只想在圖層控件中單擊圖層并且縮放級別大于某個數字時才顯示圖層,例如8. 原因之一是必須執行一些昂貴的計算才能獲得層坐標.我想使用圖層控件而不是額外的輸入按鈕(出于光學原因).

                  I want to show a layer only when its clicked in the LayersControl and the zoom level is greater than a certain number, e.g. 8. One of the reasons is, that some expensive computations must be performed to get the layer coordinates. I want to use the layerscontrol and not an extra input button (for optical reasons).

                  如果在圖層控件中單擊圖層按鈕,有沒有辦法檢索該值?

                  Is there a way to retrieve the value, if the layer button is clicked in the layerscontrol?

                  這是一個簡單的例子(不工作):

                  Here is a simple example (not working):

                  library(leaflet) 
                  library(shiny)
                  
                  ui <- fluidPage(
                    leafletOutput("map", width = "100%", height = "700")
                  )
                  
                  server <- function(input, output){
                    output$map <- renderLeaflet({
                      leaflet() %>% addTiles() %>% setView(10.4, 50.3, 7) %>%
                        addLayersControl(overlayGroups = c("marker"),
                                         options = layersControlOptions(collapsed = FALSE))
                    })
                  
                    observe({
                     # if (input$marker == TRUE){ # how to get value if layercontrol is clicked?
                        if (input$map_zoom > 8) {
                          leafletProxy("map") %>% addMarkers(lng = 10.5, lat = 50, group = "marker")
                        }
                    #  }
                    })
                  }
                  
                  shinyApp(ui = ui, server = server)
                  

                  推薦答案

                  這是第一個運行的版本.也許 smdy 想出了 sthg "cleaner" :).

                  Here is a first running version. Maybe smdy comes up with sthg "cleaner" :).

                  這里做個小解釋:

                  挑戰 1:input$marker 不作為閃亮的輸入存在.打開您的應用程序(在瀏覽器中),右鍵單擊您感興趣的標記輸入,然后在瀏覽器中選擇檢查元素"或等效標簽.您將看到該輸入的代碼.那為什么你不能訪問它.要查看您從閃亮中知道的輸入類型的差異,請創建一個 textinput 或 sthg 并同時創建檢查元素".您會看到閃亮的輸入有一個 id,....標記輸入沒有

                  Challenge 1: input$marker does not exist as shiny input. Open your app (in a browser), make a right click on the marker input you are interested in and select "Inspect Element" or the equivilant label in your browser. You will see the code of that input. So why cant you access it. To see the difference to the kind of input you know from shiny, create a textinput or sthg and make "inspect element" as well. You see that the shiny-inputs have an id,....the marker input does not

                  挑戰 2:訪問沒有 id 的輸入:(從這里開始,您應該知道如何將消息從 JS 發送到 R 并返回:您將在此處找到一篇非常好的文章:https://ryouready.wordpress.com/2013/11/20/sending-data-from-client-到服務器并返回使用閃亮/)如何訪問輸入:嗯,這基本上只是通過谷歌找到正確的片段.最后是:document.getElementsByTagName("input").(注意:從這里開始我假設你只有一個輸入)并且知道這有點棘手.嘗試訪問這個輸入.通過 console.log() 您可以打印到 javascript 控制臺(并通過F12"-> 控制臺 (JS) 在正在運行的應用程序中打開它.)您可以將此輸入打印為 HtMLCollection,但不能訪問它,這可能會非常混亂.

                  Challenge 2: Access input that does not have an id: (From here on you should know how to send messages from JS to R and back: A very good article you will find here: https://ryouready.wordpress.com/2013/11/20/sending-data-from-client-to-server-and-back-using-shiny/) How to access the input: Well, thats basically just finding the right snippet via google. In the end this: document.getElementsByTagName("input"). (Attention: From here on I assume you only have one input) And know it gets a bit tricky. Try to access this input. Via console.log() you can print to javascript console (and open it in the running app via "F12" --> Console (JS).) You can print this input as HtMLCollection but can not access it, which can be very confusing.

                  挑戰 3:訪問?? HTMLCollection

                  您無法訪問它的原因(簡而言之)是在構建DOM"之前調用了JS代碼.如果在<body></body>"之后調用腳本,它會完全正常工作.但這對于普通的香草光澤并不是那么容易.您可以嘗試 window.onload()document.ready().到目前為止,對我來說最可靠的是使用: session$onFlushed() 并觸發將該函數中的 JSCode 從 R 發送到JS".(然后通過 Shiny.onInputChange("marker", inputs[0].checked); 將值作為輸入發送回 R) --> 這將產生所需的input$marker".然而,這個函數只觸發一次,這是完全正確的行為.但是當你點擊按鈕時你不會有更新.

                  The reason (in short) why you can not access it is that the JS code is called before the "DOM" is build. It would work totally fine if the script is called after "<body></body>". But thats not that easy with plain vanilla shiny. You can try window.onload() or document.ready(). What is the most reliable for me so far is to use: session$onFlushed() and trigger to send the JSCode within that function from R to "JS". (And then send the value as an input back to R via Shiny.onInputChange("marker", inputs[0].checked); ) --> This will produce the desired "input$marker". However, this function only fires once, which is totally right behaviour. But you wont have updates when you click the button.

                  挑戰 4:更新 input$marker那么漂亮的版本是有一個函數 .onclicked()/一個輸入監聽器.也許有人可以找到解決方案.我嘗試了一個閃亮的解決方法,我告訴閃亮通過 autoInvalidate() 不斷獲取輸入的值.

                  Challenge 4: Update input$marker Well the pretty version would be to have a function .onclicked()/ a listener for the input. Maybe somebody could find a solution. I tried a workaround in shiny, that i tell shiny to constantly get value of the input via autoInvalidate().

                  挑戰 5:好吧,沒那么難,因為它只是有光澤,但為了完整性.鑒于問題中提供的代碼,標記將在加載一次時保留.一旦不滿足縮放標準,不確定是要保留還是刪除它.無論如何,如果你想讓它消失,%>% clearMarkers() 是你的朋友.

                  Challenge 5: Well, not that difficult, because it is shiny only, but for sake of completeness. Given the provided code in the question, the marker will stay when loaded once. Not sure if you want it to stay or to be removed once your zooming criteria is not met. Anyway, if you want it to disappear, %>% clearMarkers() is your friend.

                  library(leaflet)
                  library(shiny)
                  
                  getInputwithJS <- '
                  Shiny.addCustomMessageHandler("findInput",
                    function(message) {
                    var inputs = document.getElementsByTagName("input");
                    Shiny.onInputChange("marker", inputs[0].checked);
                  }
                  );
                  '
                  
                  ui <- fluidPage(
                  
                    leafletOutput("map", width = "100%", height = "700"),
                    tags$head(tags$script(HTML(getInputwithJS)))
                  )
                  
                  server <- function(input, output, session){
                    global <- reactiveValues(DOMRdy = FALSE)
                    output$map <- renderLeaflet({
                      leaflet() %>% addTiles() %>% setView(10.4, 50.3, 7) %>%
                        addLayersControl(overlayGroups = c("marker"),
                                         options = layersControlOptions(collapsed = FALSE))
                    })
                  
                    autoInvalidate <- reactiveTimer(1)
                  
                    observe({
                      autoInvalidate()
                      if(global$DOMRdy){
                        session$sendCustomMessage(type = "findInput", message = "")      
                      }
                    })
                  
                    session$onFlushed(function() {
                      global$DOMRdy <- TRUE
                    })
                  
                    observe({
                      if (!is.null(input$marker)){
                        if (input$marker == TRUE){ # how to get value if layercontrol is clicked?
                          if (input$map_zoom > 8) {
                            leafletProxy("map") %>% addMarkers(lng = 10.5, lat = 50, group = "marker")
                          }else{
                            leafletProxy("map") %>% clearMarkers()
                          }
                        }
                      }
                    })
                  }
                  
                  shinyApp(ui = ui, server = server)
                  

                  這篇關于僅當縮放級別&gt;時,才在閃亮的傳單地圖中顯示圖層8 層控制?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 - 在彈出窗口中獲取標記的緯度和經度)
                2. <legend id='rtMon'><style id='rtMon'><dir id='rtMon'><q id='rtMon'></q></dir></style></legend>
                  1. <tfoot id='rtMon'></tfoot>

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

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

                            <tbody id='rtMon'></tbody>
                            <bdo id='rtMon'></bdo><ul id='rtMon'></ul>
                            主站蜘蛛池模板: 苏州伊诺尔拆除公司_专业酒店厂房拆除_商场学校拆除_办公楼房屋拆除_家工装拆除拆旧 | 升降炉_真空气氛炉_管式电阻炉厂家-山东中辰电炉有限公司 | 陕西安玻璃自动感应门-自动重叠门-磁悬浮平开门厂家【捷申达门业】 | 欧必特空气能-商用空气能热水工程,空气能热水器,超低温空气源热泵生产厂家-湖南欧必特空气能公司 | 珠海网站建设_响应网站建设_珠海建站公司_珠海网站设计与制作_珠海网讯互联 | 【MBA备考网】-2024年工商管理硕士MBA院校/报考条件/培训/考试科目/提前面试/考试/学费-MBA备考网 | 河南卓美创业科技有限公司-河南卓美防雷公司-防雷接地-防雷工程-重庆避雷针-避雷器-防雷检测-避雷带-避雷针-避雷塔、机房防雷、古建筑防雷等-山西防雷公司 | 自动气象站_农业气象站_超声波气象站_防爆气象站-山东万象环境科技有限公司 | 一体式钢筋扫描仪-楼板测厚仪-裂缝检测仪-泰仕特(北京) | 环氧乙烷灭菌器_压力蒸汽灭菌器_低温等离子过氧化氢灭菌器 _低温蒸汽甲醛灭菌器_清洗工作站_医用干燥柜_灭菌耗材-环氧乙烷灭菌器_脉动真空压力蒸汽灭菌器_低温等离子灭菌设备_河南省三强医疗器械有限责任公司 | 【孔氏陶粒】建筑回填陶粒-南京/合肥/武汉/郑州/重庆/成都/杭州陶粒厂家 | 破碎机_上海破碎机_破碎机设备_破碎机厂家-上海山卓重工机械有限公司 | 纳米二氧化硅,白炭黑,阴离子乳化剂-臻丽拾科技 | 动环监控_机房环境监控_DCIM_机房漏水检测-斯特纽| 丹佛斯压力传感器,WISE温度传感器,WISE压力开关,丹佛斯温度开关-上海力笙工业设备有限公司 | 广西绿桂涂料--承接隔热涂料、隔音涂料、真石漆、多彩仿石漆等涂料工程双包施工 | 贵州科比特-防雷公司厂家提供贵州防雷工程,防雷检测,防雷接地,防雷设备价格,防雷产品报价服务-贵州防雷检测公司 | 好看的韩国漫画_韩漫在线免费阅读-汗汗漫画 | 防爆大气采样器-防爆粉尘采样器-金属粉尘及其化合物采样器-首页|盐城银河科技有限公司 | 深圳侦探联系方式_深圳小三调查取证公司_深圳小三分离机构 | 环境模拟实验室_液体-气体控温机_气体控温箱_无锡双润冷却科技有限公司 | 粉丝机械,粉丝烘干机,粉丝生产线-招远市远东粉丝机械有限公司 | 无菌水质袋-NASCO食品无菌袋-Whirl-Pak无菌采样袋-深圳市慧普德贸易有限公司 | 全自动过滤器_反冲洗过滤器_自清洗过滤器_量子除垢环_量子环除垢_量子除垢 - 安士睿(北京)过滤设备有限公司 | 钛合金标准件-钛合金螺丝-钛管件-钛合金棒-钛合金板-钛合金锻件-宝鸡远航钛业有限公司 | 写方案网_方案策划方案模板下载| 400电话_400电话申请_888元包年_400电话办理服务中心_400VIP网 | 企业管理培训,企业培训公开课,企业内训课程,企业培训师 - 名课堂企业管理培训网 | 单柱拉力机-橡胶冲片机-哑铃裁刀-江都轩宇试验机械厂 | 金蝶帐无忧|云代账软件|智能财税软件|会计代账公司专用软件 | 色油机-色母机-失重|称重式混料机-称重机-米重机-拌料机-[东莞同锐机械]精密计量科技制造商 | 儿童语言障碍训练-武汉优佳加感统文化发展有限公司 | 南京技嘉环保科技有限公司-杀菌除臭剂|污水|垃圾|厕所|橡胶厂|化工厂|铸造厂除臭剂 | 对夹式止回阀厂家,温州对夹式止回阀制造商--永嘉县润丰阀门有限公司 | 青岛代理记账_青岛李沧代理记账公司_青岛崂山代理记账一个月多少钱_青岛德辉财税事务所官网 | 分光色差仪,测色仪,反透射灯箱,爱色丽分光光度仪,美能达色差仪维修_苏州欣美和仪器有限公司 | 行吊_电动单梁起重机_双梁起重机_合肥起重机_厂家_合肥市神雕起重机械有限公司 | 环球电气之家-中国专业电气电子产品行业服务网站! | 碳钢法兰厂家,非标法兰,定制异型,法兰生产厂家-河北九瑞管道 | 法钢特种钢材(上海)有限公司 - 耐磨钢板、高强度钢板销售加工 阀门智能定位器_电液动执行器_气动执行机构-赫尔法流体技术(北京)有限公司 | 吊篮式|移动式冷热冲击试验箱-二槽冷热冲击试验箱-广东科宝 |