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

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

    <legend id='Sfavi'><style id='Sfavi'><dir id='Sfavi'><q id='Sfavi'></q></dir></style></legend>

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

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

      <tfoot id='Sfavi'></tfoot>

      1. 如何在 Shiny 中保存帶有繪制形狀/點的傳單地圖

        How to save a leaflet map with drawn shapes/points on it in Shiny?(如何在 Shiny 中保存帶有繪制形狀/點的傳單地圖?)
        <tfoot id='flSMW'></tfoot>
        <legend id='flSMW'><style id='flSMW'><dir id='flSMW'><q id='flSMW'></q></dir></style></legend>
        <i id='flSMW'><tr id='flSMW'><dt id='flSMW'><q id='flSMW'><span id='flSMW'><b id='flSMW'><form id='flSMW'><ins id='flSMW'></ins><ul id='flSMW'></ul><sub id='flSMW'></sub></form><legend id='flSMW'></legend><bdo id='flSMW'><pre id='flSMW'><center id='flSMW'></center></pre></bdo></b><th id='flSMW'></th></span></q></dt></tr></i><div class="ltzhtlp" id='flSMW'><tfoot id='flSMW'></tfoot><dl id='flSMW'><fieldset id='flSMW'></fieldset></dl></div>

        • <small id='flSMW'></small><noframes id='flSMW'>

            <bdo id='flSMW'></bdo><ul id='flSMW'></ul>
                  <tbody id='flSMW'></tbody>

                  本文介紹了如何在 Shiny 中保存帶有繪制形狀/點的傳單地圖?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  這個問題是問題如何保存的后續問題Shiny 中的傳單地圖,以及在 Shiny 中保存傳單地圖.

                  This question is a follow-up to the questions How to save a leaflet map in Shiny, and Save leaflet map in Shiny.

                  我添加了一個工具欄來在地圖上繪制形狀/點,它是leaflet.extras 包中的addDrawToolbar.這讓用戶可以交互式地繪制線條、形狀…….最后,我希望能夠將帶有繪制形狀的地圖保存為 pdf 或 png.

                  I add a toolbar to draw shapes/points on the map that is addDrawToolbar in the leaflet.extras package. That lets users to draw lines, shapes, ... interactively. In the end I want one to be able to save the map with the drawn shapes as a pdf or png.

                  我利用問題的答案編寫了以下代碼:如何在 Shiny 中保存傳單地圖.但這無助于實現我的目標.

                  I have coded up the following making use of the answer to the question: How to save a leaflet map in Shiny. But it does not help achieve my goal.

                  有沒有人可以幫助我?

                  library(shiny)
                  library(leaflet)
                  library(leaflet.extras)
                  library(mapview)
                  
                  
                  ui <- fluidPage(
                  
                      leafletOutput("map"),
                      br(),
                      downloadButton("download_pdf", "Download .pdf")
                  )
                  
                  server <- function(input, output, session) {
                  
                  
                       foundational_map <- reactive({
                  
                          leaflet() %>% 
                  
                            addTiles()%>%
                  
                            addMeasure(
                                primaryLengthUnit = "kilometers",
                                secondaryAreaUnit = FALSE
                             )%>%
                  
                            addDrawToolbar(
                                 targetGroup='draw',
                  
                                 editOptions = editToolbarOptions(selectedPathOptions = 
                                                         selectedPathOptions()),
                  
                                  polylineOptions = filterNULL(list(shapeOptions = 
                                                          drawShapeOptions(lineJoin = "round", 
                                                          weight = 3))),
                  
                                  circleOptions = filterNULL(list(shapeOptions = 
                                                        drawShapeOptions(),
                                                        repeatMode = F,
                                                        showRadius = T,
                                                        metric = T,
                                                        feet = F,
                                                        nautic = F))) %>%
                             setView(lat = 45, lng = 9, zoom = 3) %>%
                             addStyleEditor(position = "bottomleft", 
                                   openOnLeafletDraw = TRUE)
                   })
                  
                  
                   output$map <- renderLeaflet({
                  
                           foundational_map()
                                      })
                  
                  
                   user_created_map <- reactive({
                  
                             foundational_map() %>%
                  
                              setView(lng = input$map_center$lng, lat = input$map_center$lat, 
                                             zoom = input$map_zoom)
                               })
                  
                  
                   output$download_pdf <- downloadHandler(
                  
                           filename = paste0("map_", Sys.time(), ".pdf"),
                  
                           content = function(file) {
                                   mapshot(user_created_map(), file = file)
                    }
                   )
                  
                  
                  
                   }
                  
                   shinyApp(ui = ui, server = server)
                  

                  推薦答案

                  顯然 mapshot 函數不知道繪制的多邊形,只存儲干凈的傳單地圖,因為它啟動了一個隔離的后臺進程捕獲網絡快照.

                  Apparently the mapshot function is not aware of drawn polygons and just stores the clean leaflet-map, as it launches an isolated background process which captures the webshot.

                  我會提出這個解決方法,它捕獲整個屏幕(使用這個 batch-file) 并將其保存為 png.(僅適用于 Windows)

                  I would propose this workaround, which captures the whole screen (using this batch-file) and saves it as png. (only for Windows)

                  這不是很漂亮,因為它還會捕獲窗口和瀏覽器菜單欄,盡管可以在批處理文件中進行調整.

                  This is not very beautiful as it will also capture the windows and browser menu bars, although that could be adapted in the batch-file.

                  批處理文件必須在同一目錄中,并且必須命名為 screenCapture.bat.

                  The batch-file must be in the same directory and must be named screenCapture.bat .

                  library(shiny)
                  library(leaflet)
                  library(leaflet.extras)
                  library(mapview)
                  
                  ui <- fluidPage(
                    leafletOutput("map"),
                    actionButton("download_pdf", "Download .pdf")
                  )
                  
                  server <- function(input, output, session) {
                    foundational_map <- reactive({
                      leaflet() %>%
                        addTiles()%>%
                        addMeasure(
                          primaryLengthUnit = "kilometers",
                          secondaryAreaUnit = FALSE
                        )%>%
                        addDrawToolbar(
                          targetGroup='draw',
                          editOptions = editToolbarOptions(selectedPathOptions = 
                                                             selectedPathOptions()),
                          polylineOptions = filterNULL(list(shapeOptions = 
                                                              drawShapeOptions(lineJoin = "round", 
                                                                               weight = 3))),
                          circleOptions = filterNULL(list(shapeOptions = 
                                                            drawShapeOptions(),
                                                          repeatMode = F,
                                                          showRadius = T,
                                                          metric = T,
                                                          feet = F,
                                                          nautic = F))) %>%
                        setView(lat = 45, lng = 9, zoom = 3) %>%
                        addStyleEditor(position = "bottomleft", 
                                       openOnLeafletDraw = TRUE)
                    })
                    output$map <- renderLeaflet({
                      foundational_map()
                    })
                    user_created_map <- reactive({
                      foundational_map()
                    })
                  
                    ## observeEvent which makes a call to the Batch-file and saves the image as .png
                    observeEvent(input$download_pdf, {
                      img = paste0("screen", runif(1,0,1000), ".png")
                      str = paste('call screenCapture ', img)
                      shell(str)
                    })
                  
                  }
                  
                  shinyApp(ui = ui, server = server)
                  

                  為了刪除瀏覽器和 Windows 工具欄,我像這樣操作 .bat 文件:

                  To remove the browser and Windows toolbar, I manipulated the .bat-file like this:

                  第 66 行:

                  int height = windowRect.bottom - windowRect.top - 37;
                  

                  第 75 行:

                  GDI32.BitBlt(hdcDest, 0, -80, width, height, hdcSrc, 0, 0, GDI32.SRCCOPY);
                  

                  這適用于我的機器,但您必須調整這些值,甚至想出更好的解決方案,因為我不得不承認我不太擅長批處理腳本.這將隱藏工具欄,但底部會有一個黑色條帶.

                  This works on my machine, but you will have to adapt the values or even come up with a better solution, since I have to admit that I'm not too good at batch scripting. This will hide the toolbars, but there will be a black strip at the bottom.

                  這篇關于如何在 Shiny 中保存帶有繪制形狀/點的傳單地圖?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 - 在彈出窗口中獲取標記的緯度和經度)
                1. <small id='GxBKF'></small><noframes id='GxBKF'>

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

                          • <bdo id='GxBKF'></bdo><ul id='GxBKF'></ul>
                            <legend id='GxBKF'><style id='GxBKF'><dir id='GxBKF'><q id='GxBKF'></q></dir></style></legend>
                            主站蜘蛛池模板: 液氮罐_液氮容器_自增压液氮罐_杜瓦瓶_班德液氮罐厂家 | 室内室外厚型|超薄型|非膨胀型钢结构防火涂料_隧道专用防火涂料厂家|电话|价格|批发|施工 | 单机除尘器 骨架-脉冲除尘器设备生产厂家-润天环保设备 | 办公室家具_板式办公家具定制厂家-FMARTS福玛仕办公家具 | 电气控制系统集成商-PLC控制柜变频控制柜-非标自动化定制-电气控制柜成套-NIDEC CT变频器-威肯自动化控制 | 湿地保护| 危废处理系统,水泥厂DCS集散控制系统,石灰窑设备自动化控制系统-淄博正展工控设备 | 五轴加工中心_数控加工中心_铝型材加工中心-罗威斯 | 南京技嘉环保科技有限公司-杀菌除臭剂|污水|垃圾|厕所|橡胶厂|化工厂|铸造厂除臭剂 | 西安耀程造价培训机构_工程预算实训_广联达实作实操培训 | 非标压力容器_碳钢储罐_不锈钢_搪玻璃反应釜厂家-山东首丰智能环保装备有限公司 | 混合生育酚_醋酸生育酚粉_琥珀酸生育酚-山东新元素生物科技 | 干粉砂浆设备_干混砂浆生产线_腻子粉加工设备_石膏抹灰砂浆生产成套设备厂家_干粉混合设备_砂子烘干机--郑州铭将机械设备有限公司 | 桨叶搅拌机_螺旋挤压/方盒旋切造粒机厂家-无锡市鸿诚输送机械有限公司 | 海尔生物医疗四川代理商,海尔低温冰箱四川销售-成都壹科医疗器械有限公司 | 技德应用| 礼仪庆典公司,礼仪策划公司,庆典公司,演出公司,演艺公司,年会酒会,生日寿宴,动工仪式,开工仪式,奠基典礼,商务会议,竣工落成,乔迁揭牌,签约启动-东莞市开门红文化传媒有限公司 | 牛皮纸|牛卡纸|进口牛皮纸|食品级牛皮纸|牛皮纸厂家-伽立实业 | 诺冠气动元件,诺冠电磁阀,海隆防爆阀,norgren气缸-山东锦隆自动化科技有限公司 | 体视显微镜_荧光生物显微镜_显微镜报价-微仪光电生命科学显微镜有限公司 | 拼装地板,悬浮地板厂家,悬浮式拼装运动地板-石家庄博超地板科技有限公司 | 并网柜,汇流箱,电控设备,中高低压开关柜,电气电力成套设备,PLC控制设备订制厂家,江苏昌伟业新能源科技有限公司 | 电伴热系统施工_仪表电伴热保温箱厂家_沃安电伴热管缆工业技术(济南)有限公司 | 真空乳化机-灌装封尾机-首页-温州精灌 | 定制异形重型钢格栅板/钢格板_定做踏步板/排水沟盖板_钢格栅板批发厂家-河北圣墨金属制品有限公司 | 磁棒电感生产厂家-电感器厂家-电感定制-贴片功率电感供应商-棒形电感生产厂家-苏州谷景电子有限公司 | 碳纤维复合材料制品生产定制工厂订制厂家-凯夫拉凯芙拉碳纤维手机壳套-碳纤维雪茄盒外壳套-深圳市润大世纪新材料科技有限公司 | 全屋整木定制-橱柜,家具定制-四川峨眉山龙马木业有限公司 | 瓶盖扭矩测试仪-瓶盖扭力仪-全自动扭矩仪-济南三泉中石单品站 | 青岛侦探调查_青岛侦探事务所_青岛调查事务所_青岛婚外情取证-青岛狄仁杰国际侦探公司 | 澳威全屋定制官网|极简衣柜十大品牌|衣柜加盟代理|全屋定制招商 百度爱采购运营研究社社群-店铺托管-爱采购代运营-良言多米网络公司 | 生物制药洁净车间-GMP车间净化工程-食品净化厂房-杭州波涛净化设备工程有限公司 | 带式压滤机_污泥压滤机_污泥脱水机_带式过滤机_带式压滤机厂家-河南恒磊环保设备有限公司 | 诗词大全-古诗名句 - 古诗词赏析| 桁架楼承板-钢筋桁架楼承板-江苏众力达钢筋楼承板厂 | 南京种植牙医院【官方挂号】_南京治疗种植牙医院那个好_南京看种植牙哪里好_南京茀莱堡口腔医院 尼龙PA610树脂,尼龙PA612树脂,尼龙PA1010树脂,透明尼龙-谷骐科技【官网】 | 二手注塑机回收_旧注塑机回收_二手注塑机买卖 - 大鑫二手注塑机 二手光谱仪维修-德国OBLF光谱仪|进口斯派克光谱仪-热电ARL光谱仪-意大利GNR光谱仪-永晖检测 | 全自动真空上料机_粉末真空上料机_气动真空上料机-南京奥威环保科技设备有限公司 | 合肥防火门窗/隔断_合肥防火卷帘门厂家_安徽耐火窗_良万消防设备有限公司 | 通辽信息港 - 免费发布房产、招聘、求职、二手、商铺等信息 www.tlxxg.net | 超声波流量计_流量标准装置生产厂家 _河南盛天精密测控 |