久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <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="qwawimqqmiuu" 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 中保存帶有繪制形狀/點(diǎn)的傳單地圖

        How to save a leaflet map with drawn shapes/points on it in Shiny?(如何在 Shiny 中保存帶有繪制形狀/點(diǎn)的傳單地圖?)
        <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="qwawimqqmiuu" 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 中保存帶有繪制形狀/點(diǎn)的傳單地圖?的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  這個(gè)問題是問題如何保存的后續(xù)問題Shiny 中的傳單地圖,以及在 Shiny 中保存?zhèn)鲉蔚貓D.

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

                  我添加了一個(gè)工具欄來在地圖上繪制形狀/點(diǎn),它是leaflet.extras 包中的addDrawToolbar.這讓用戶可以交互式地繪制線條、形狀…….最后,我希望能夠?qū)в欣L制形狀的地圖保存為 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 中保存?zhèn)鲉蔚貓D.但這無助于實(shí)現(xiàn)我的目標(biāo).

                  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 函數(shù)不知道繪制的多邊形,只存儲干凈的傳單地圖,因?yàn)樗鼏?dòng)了一個(gè)隔離的后臺進(jìn)程捕獲網(wǎng)絡(luò)快照.

                  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.

                  我會提出這個(gè)解決方法,它捕獲整個(gè)屏幕(使用這個(gè) 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)

                  這不是很漂亮,因?yàn)樗€會捕獲窗口和瀏覽器菜單欄,盡管可以在批處理文件中進(jìn)行調(diào)整.

                  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);
                  

                  這適用于我的機(jī)器,但您必須調(diào)整這些值,甚至想出更好的解決方案,因?yàn)槲也坏貌怀姓J(rèn)我不太擅長批處理腳本.這將隱藏工具欄,但底部會有一個(gè)黑色條帶.

                  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.

                  這篇關(guān)于如何在 Shiny 中保存帶有繪制形狀/點(diǎn)的傳單地圖?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)度)
                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="qwawimqqmiuu" 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>
                            主站蜘蛛池模板: 国产精品视频不卡 | 91xxx在线观看| 亚洲性爰 | 国产偷录叫床高潮录音 | 国产成人精品免高潮在线观看 | 欧美视频网| 国产精品久久久久久久粉嫩 | 天堂影院av | 国产精品久久久久久久久久免费看 | 欧美一区二区三区四区视频 | 日本字幕在线观看 | 精品国产一区二区三区久久久久久 | 国产精品久久久久久久久免费软件 | 国产日产欧产精品精品推荐蛮挑 | 99久久影院 | 黄色大片视频 | 国产乱码精品一区二区三区av | 中文字幕高清免费日韩视频在线 | 成人av网站在线观看 | 国产在线视频一区二区董小宛性色 | 一区二区三区网站 | 日韩国产欧美一区 | 日日干日日射 | 超碰最新在线 | 欧美成年网站 | 欧美一区不卡 | 成人精品毛片国产亚洲av十九禁 | 国产亚洲精品精品国产亚洲综合 | 中国一级大毛片 | 中文字幕日韩一区 | 中文天堂在线一区 | 一区二区精品在线 | 亚洲精品久久国产高清情趣图文 | 久久精品国产一区二区三区不卡 | 国产大片一区 | 高清成人免费视频 | 99热精品6 | 欧美一区二区三区久久精品视 | 神马久久春色视频 | av网站在线免费观看 | 久久精品亚洲欧美日韩精品中文字幕 |