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="r7tvrtr" 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. 僅當(dāng)縮放級別&gt;時(shí),才在閃亮的傳單地圖中顯

        Show layer in leaflet map in Shiny only when zoom level gt; 8 with LayersControl?(僅當(dāng)縮放級別gt;時(shí),才在閃亮的傳單地圖中顯示圖層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="tlltdh5" 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. 本文介紹了僅當(dāng)縮放級別&gt;時(shí),才在閃亮的傳單地圖中顯示圖層8 層控制?的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

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

                  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?

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

                  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)
                  

                  推薦答案

                  這是第一個(gè)運(yùn)行的版本.也許 smdy 想出了 sthg "cleaner" :).

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

                  這里做個(gè)小解釋:

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

                  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

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

                  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.

                  挑戰(zhàn) 3:訪問?? HTMLCollection

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

                  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.

                  挑戰(zhàn) 4:更新 input$marker那么漂亮的版本是有一個(gè)函數(shù) .onclicked()/一個(gè)輸入監(jiān)聽器.也許有人可以找到解決方案.我嘗試了一個(gè)閃亮的解決方法,我告訴閃亮通過 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().

                  挑戰(zhàn) 5:好吧,沒那么難,因?yàn)樗皇怯泄鉂桑珵榱送暾?鑒于問題中提供的代碼,標(biāo)記將在加載一次時(shí)保留.一旦不滿足縮放標(biāo)準(zhǔn),不確定是要保留還是刪除它.無論如何,如果你想讓它消失,%>% 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)
                  

                  這篇關(guān)于僅當(dāng)縮放級別&gt;時(shí),才在閃亮的傳單地圖中顯示圖層8 層控制?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  Check if a polygon point is inside another in leaflet(檢查一個(gè)多邊形點(diǎn)是否在傳單中的另一個(gè)內(nèi)部)
                  Changing leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改傳單標(biāo)記群集圖標(biāo)顏色,繼承其余默認(rèn) CSS 屬性)
                  Trigger click on leaflet marker(觸發(fā)點(diǎn)擊傳單標(biāo)記)
                  How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默認(rèn)加載磁貼顏色?)
                  Adding Leaflet layer control to sidebar(將 Leaflet 圖層控件添加到側(cè)邊欄)
                  Leaflet - get latitude and longitude of a marker inside a pop-up(Leaflet - 在彈出窗口中獲取標(biāo)記的緯度和經(jīng)度)
                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="xv77j77" 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>
                            主站蜘蛛池模板: 智成电子深圳tdk一级代理-提供TDK电容电感贴片蜂鸣器磁芯lambda电源代理经销,TDK代理商有哪些TDK一级代理商排名查询。-深圳tdk一级代理 | 胶水,胶粘剂,AB胶,环氧胶,UV胶水,高温胶,快干胶,密封胶,结构胶,电子胶,厌氧胶,高温胶水,电子胶水-东莞聚力-聚厉胶粘 | 包装设计公司,产品包装设计|包装制作,包装盒定制厂家-汇包装【官方网站】 | 防腐木批发价格_深圳_惠州_东莞防腐木厂家_森源(深圳)防腐木有限公司 | 红外光谱仪维修_二手红外光谱仪_红外压片机_红外附件-天津博精仪器 | 玻璃钢型材-玻璃钢风管-玻璃钢管道,生产厂家-[江苏欧升玻璃钢制造有限公司] | 酒糟烘干机-豆渣烘干机-薯渣烘干机-糟渣烘干设备厂家-焦作市真节能环保设备科技有限公司 | 南京和瑞包装有限公司 | 钢结构厂房造价_钢结构厂房预算_轻钢结构厂房_山东三维钢结构公司 | T恤衫定做,企业文化衫制作订做,广告T恤POLO衫定制厂家[源头工厂]-【汉诚T恤定制网】 | 聚氨酯催化剂K15,延迟催化剂SA-1,叔胺延迟催化剂,DBU,二甲基哌嗪,催化剂TMR-2,-聚氨酯催化剂生产厂家 | 注塑机-压铸机-塑料注塑机-卧式注塑机-高速注塑机-单缸注塑机厂家-广东联升精密智能装备科技有限公司 | 四川成人高考_四川成考报名网 | 购买舔盐、舔砖、矿物质盐压块机,鱼饵、鱼饲料压块机--请到杜甫机械 | 斗式提升机,斗式提升机厂家-淄博宏建机械有限公司 | 东莞市海宝机械有限公司-不锈钢分选机-硅胶橡胶-生活垃圾-涡电流-静电-金属-矿石分选机 | 耐高温风管_耐高温软管_食品级软管_吸尘管_钢丝软管_卫生级软管_塑料波纹管-东莞市鑫翔宇软管有限公司 | Akribis直线电机_直线模组_力矩电机_直线电机平台|雅科贝思Akribis-杭州摩森机电科技有限公司 | 无菌实验室规划装修设计-一体化实验室承包-北京洁净净化工程建设施工-北京航天科恩实验室装备工程技术有限公司 | 玻璃钢罐_玻璃钢储罐_盐酸罐厂家-河北华盛节能设备有限公司 | 西安展台设计搭建_西安活动策划公司_西安会议会场布置_西安展厅设计西安旭阳展览展示 | 不锈钢钢格栅板_热浸锌钢格板_镀锌钢格栅板_钢格栅盖板-格美瑞 | 锻造液压机,粉末冶金,拉伸,坩埚成型液压机定制生产厂家-山东威力重工官方网站 | 申江储气罐厂家,储气罐批发价格,储气罐规格-上海申江压力容器有限公司(厂) | 成都网站建设制作_高端网站设计公司「做网站送优化推广」 | 北京印刷厂_北京印刷_北京印刷公司_北京印刷厂家_北京东爵盛世印刷有限公司 | 北京易通慧公司从事北京网站优化,北京网络推广、网站建设一站式服务商-北京网站优化公司 | 【铜排折弯机,钢丝折弯成型机,汽车发泡钢丝折弯机,线材折弯机厂家,线材成型机,铁线折弯机】贝朗折弯机厂家_东莞市贝朗自动化设备有限公司 | 底部填充胶_电子封装胶_芯片封装胶_芯片底部填充胶厂家-东莞汉思新材料 | 重庆磨床过滤机,重庆纸带过滤机,机床伸缩钣金,重庆机床钣金护罩-重庆达鸿兴精密机械制造有限公司 | X光检测仪_食品金属异物检测机_X射线检测设备_微现检测 | 电子海图系统-电梯检验系统-智慧供热系统开发-商品房预售资金监管系统 | SMC-SMC电磁阀-日本SMC气缸-SMC气动元件展示网 | 南京展台搭建-南京展会设计-南京展览设计公司-南京展厅展示设计-南京汇雅展览工程有限公司 | 桐城新闻网—桐城市融媒体中心主办 | 紫外荧光硫分析仪-硫含量分析仪-红外光度测定仪-泰州美旭仪器 | 粉末包装机,拆包机厂家,价格-上海强牛包装机械设备有限公司 | 液压升降货梯_导轨式升降货梯厂家_升降货梯厂家-河南东圣升降设备有限公司 | 济南律师,济南法律咨询,山东法律顾问-山东沃德律师事务所 | 石英砂矿石色选机_履带辣椒色选机_X光异物检测机-合肥幼狮光电科技 | 转向助力泵/水泵/发电机皮带轮生产厂家-锦州华一精工有限公司 |