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="gawqi2c" 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="esuau0c" 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="ks2omku" 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>
                            主站蜘蛛池模板: 小型铜米机-干式铜米机-杂线全自动铜米机-河南鑫世昌机械制造有限公司 | 砖机托板价格|免烧砖托板|空心砖托板厂家_山东宏升砖机托板厂 | 武汉刮刮奖_刮刮卡印刷厂_为企业提供门票印刷_武汉合格证印刷_现金劵代金券印刷制作 - 武汉泽雅印刷有限公司 | 浙江筋膜枪-按摩仪厂家-制造商-肩颈按摩仪哪家好-温州市合喜电子科技有限公司 | 「安徽双凯」自动售货机-无人售货机-成人用品-自动饮料食品零食售货机 | 碳化硅,氮化硅,冰晶石,绢云母,氟化铝,白刚玉,棕刚玉,石墨,铝粉,铁粉,金属硅粉,金属铝粉,氧化铝粉,硅微粉,蓝晶石,红柱石,莫来石,粉煤灰,三聚磷酸钠,六偏磷酸钠,硫酸镁-皓泉新材料 | 首页-恒温恒湿试验箱_恒温恒湿箱_高低温试验箱_高低温交变湿热试验箱_苏州正合 | sfp光模块,高速万兆光模块工厂-性价比更高的光纤模块制造商-武汉恒泰通 | 卫生纸复卷机|抽纸机|卫生纸加工设备|做卫生纸机器|小型卫生纸加工需要什么设备|卫生纸机器设备多少钱一台|许昌恒源纸品机械有限公司 | 连续密炼机_双转子连续密炼机_连续式密炼机-南京永睿机械制造有限公司 | 酒店品牌设计-酒店vi设计-酒店标识设计【国际级】VI策划公司 | 专业生物有机肥造粒机,粉状有机肥生产线,槽式翻堆机厂家-郑州华之强重工科技有限公司 | 山东钢衬塑罐_管道_反应釜厂家-淄博富邦滚塑防腐设备科技有限公司 | 楼承板-钢筋楼承板-闭口楼承板-无锡优贝斯楼承板厂 | 标准件-非标紧固件-不锈钢螺栓-非标不锈钢螺丝-非标螺母厂家-三角牙锁紧自攻-南京宝宇标准件有限公司 | 富森高压水枪-柴油驱动-养殖场高压清洗机-山东龙腾环保科技有限公司 | 污水提升器,污水提升泵,地下室排水,增压泵,雨水泵,智能供排水控制器-上海智流泵业有限公司 | 成都网站建设制作_高端网站设计公司「做网站送优化推广」 | 无痕胶_可移胶_无痕双面胶带_可移无痕胶厂家-东莞凯峰 | 低温柔性试验仪-土工布淤堵-沥青车辙试验仪-莱博特(天津)试验机有限公司 | 河南道路标志牌_交通路标牌_交通标志牌厂家-郑州路畅交通 | 汽车水泵_汽车水泵厂家-瑞安市骏迪汽车配件有限公司 | 武汉高低温试验机-现货恒温恒湿试验箱-高低温湿热交变箱价格-湖北高天试验设备 | 锡膏喷印机-全自动涂覆机厂家-全自动点胶机-视觉点胶机-深圳市博明智控科技有限公司 | 锡膏喷印机-全自动涂覆机厂家-全自动点胶机-视觉点胶机-深圳市博明智控科技有限公司 | 盐城网络公司_盐城网站优化_盐城网站建设_盐城市启晨网络科技有限公司 | 西安展台设计搭建_西安活动策划公司_西安会议会场布置_西安展厅设计西安旭阳展览展示 | 沈阳建筑设计公司_加固改造设计_厂房设计_设计资质加盟【金辉设计】 | 振动筛-交叉筛-螺旋筛-滚轴筛-正弦筛-方形摇摆筛「新乡振动筛厂家」 | 本安接线盒-本安电路用接线盒-本安分线盒-矿用电话接线盒-JHH生产厂家-宁波龙亿电子科技有限公司 | 复合土工膜厂家|hdpe防渗土工膜|复合防渗土工布|玻璃纤维|双向塑料土工格栅-安徽路建新材料有限公司 | 亿立分板机_曲线_锯片式_走刀_在线式全自动_铣刀_在线V槽分板机-杭州亿协智能装备有限公司 | 杭州中央空调维修_冷却塔/新风机柜/热水器/锅炉除垢清洗_除垢剂_风机盘管_冷凝器清洗-杭州亿诺能源有限公司 | 品牌策划-品牌设计-济南之式传媒广告有限公司官网-提供品牌整合丨影视创意丨公关活动丨数字营销丨自媒体运营丨数字营销 | led冷热冲击试验箱_LED高低温冲击试验箱_老化试验箱-爱佩百科 | 一路商机网-品牌招商加盟优选平台-加盟店排行榜平台 | 不锈钢复合板厂家_钛钢复合板批发_铜铝复合板供应-威海泓方金属复合材料股份有限公司 | 安徽千住锡膏_安徽阿尔法锡膏锡条_安徽唯特偶锡膏_卡夫特胶水-芜湖荣亮电子科技有限公司 | 智慧物联网行业一站式解决方案提供商-北京东成基业 | 智成电子深圳tdk一级代理-提供TDK电容电感贴片蜂鸣器磁芯lambda电源代理经销,TDK代理商有哪些TDK一级代理商排名查询。-深圳tdk一级代理 | 展厅设计-展馆设计-专业企业展厅展馆设计公司-昆明华文创意 |