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

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

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

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

        在 R 中自定義傳單彈出窗口

        Customizing leaflet popup in R(在 R 中自定義傳單彈出窗口)

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

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

                  <tbody id='LcUKP'></tbody>
                1. 本文介紹了在 R 中自定義傳單彈出窗口的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在使用 RStudio 創建一個等值線傳單地圖.我在導入到 R 的 shapefile 中有 Country 和 Url 作為屬性.

                  我希望在最終地圖的彈出窗口中將國家名稱和 URL 顯示為超鏈接.

                  以下是我目前使用的代碼:

                  m <- world_shapefiles %>%傳單() %>%addProviderTiles(providers$Esri.WorldStreetMap) %>%添加多邊形(標簽=?國家,labelOptions = labelOptions(style = list("font-weight" = "normal", padding = "3px 8px", textsize = "15px",方向=自動")),popup = ~ paste("國家:", 國家, "<br/>","<b/>","URL:", url))

                  我想在彈出窗口中看到文本單擊此處"而不是整個 url,我嘗試使用以下代碼但沒有成功.

                  popup = ~ paste("Country:", counry, "<br/>","<b/>","URL:", "<b><a href=url>點擊這里</a></b>")

                  有什么想法可以實現嗎?

                  解決方案

                  概覽

                  看完

                  # 加載必要的包圖書館(傳單)圖書館(SF)# 下載壓縮文件下載文件(url = "http://thematicmapping.org/downloads/TM_WORLD_BORDERS-0.3.zip", destfile = "TM_WORLD_BORDERS-0.3.zip")# 解壓解壓縮(zipfile =TM_WORLD_BORDERS-0.3.zip")# 轉換為 sf世界.邊界 <-read_sf(dsn = getwd(),層=TM_WORLD_BORDERS-0.3")# 添加每個國家的維基百科頁面world.borders$wiki <-paste0("https://en.wikipedia.org/wiki/", world.borders$NAME)# 制作傳單地圖我的.map <-傳單(選項=傳單選項(minZoom = 2))%>%setMaxBounds(lng1 = -180, lat1 = -89.98155760646617, lng2 = 180, lat2 = 89.99346179538875 ) %>%addTiles(urlTemplate = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}")%>%addPolygons(數據 = world.borders, 填充 = "#D24618", 顏色 = "#D24618", 不透明度 = 0.5, 填充不透明度 = 0.01, 重量 = 3, 彈出 = paste0(<b>國家:</b>", world.borders$NAME, "<br>", "

                  I am using RStudio to create a choropleth leaflet map. I have Country and Url as an attribute in the shapefile that I imported to R.

                  I wish to show the Country name and URL as a hyperlink within the popup of the final map.

                  Below is the code I have used so far:

                  m <- world_shapefiles %>%
                    leaflet() %>%
                    addProviderTiles(providers$Esri.WorldStreetMap) %>%      
                    addPolygons( 
                        label=~country, 
                              labelOptions = labelOptions(style = list("font-weight" = "normal", padding = "3px 8px", textsize = "15px",
                  direction = "auto")), 
                                popup = ~ paste("Country:", country, "<br/>","<b/>","URL:", url)
                  )
                  

                  I want to see the text "Click here" instead of the entire url in the popup, I tried using the below code with no luck.

                  popup = ~ paste("Country:", counry, "<br/>","<b/>","URL:", "<b><a href=url>Click Here</a></b>")
                  

                  Any ideas to achieve it?

                  解決方案

                  Overview

                  After reading R, leaflet package, Passing a character vector of HTML tags to popups?, here's how you would modify your existing code:

                  # it seems ~ doesn't work inside of the paste0() function
                  # which is why I accessed the variables through the $
                  popup = paste0( "Country:"
                                   , world_shapefiles$country 
                                   , "<br>"
                                   , "<a href='"
                                   , world_shapefiles$url
                                   , "' target='_blank'>"
                                   , "Click Here</a>"
                                 )
                  

                  Reproducible Example

                  I use the World Borders Data Set to download shapefiles for each country in the world. I then add a Wikipedia URL for each country in the data set.

                  # load necessary packages
                  library( leaflet )
                  library( sf )
                  
                  # download zip file
                  download.file(
                    url = "http://thematicmapping.org/downloads/TM_WORLD_BORDERS-0.3.zip"
                    , destfile = "TM_WORLD_BORDERS-0.3.zip"
                  )
                  
                  # unzip 
                  unzip( zipfile = "TM_WORLD_BORDERS-0.3.zip" )
                  
                  # transfrom to sf
                  world.borders <-
                    read_sf( dsn = getwd()
                             , layer = "TM_WORLD_BORDERS-0.3" )
                  
                  # add the wikipedia page for each country
                  world.borders$wiki <-
                    paste0( "https://en.wikipedia.org/wiki/", world.borders$NAME )
                  
                  # make leaflet map
                  my.map <-
                    leaflet( options = leafletOptions( minZoom = 2 ) ) %>%
                    setMaxBounds( lng1 = -180
                                  , lat1 = -89.98155760646617
                                  , lng2 = 180
                                  , lat2 = 89.99346179538875 ) %>%
                    addTiles( urlTemplate = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}" ) %>%
                    addPolygons( data = world.borders
                                 , fill = "#D24618"
                                 , color = "#D24618"
                                 , opacity = 0.5
                                 , fillOpacity = 0.01
                                 , weight = 3
                                 , popup = paste0(
                                   "<b>Country: </b>"
                                   , world.borders$NAME
                                   , "<br>"
                                   , "<a href='"
                                   , world.borders$wiki
                                   , "' target='_blank'>"
                                   , "Click Here to View Wiki</a>"
                                 )
                                 , label = ~NAME
                                 , labelOptions = labelOptions(
                                   style = list("font-weight" = "normal"
                                                , padding = "3px 8px"
                                                , textsize = "15px"
                                                , direction = "auto" ) )
                                 , highlightOptions = highlightOptions( 
                                   color = "#10539A"
                                   , weight = 3
                                   , fillColor = NA
                                 ))
                  
                  # display map
                  my.map
                  
                  # end of script #
                  

                  這篇關于在 R 中自定義傳單彈出窗口的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 中的默認加載磁貼顏色?)
                  Add external geojson to leaflet layer(將外部geojson添加到傳單層)
                  Adding Leaflet layer control to sidebar(將 Leaflet 圖層控件添加到側邊欄)
                  • <bdo id='dTNs7'></bdo><ul id='dTNs7'></ul>
                    <i id='dTNs7'><tr id='dTNs7'><dt id='dTNs7'><q id='dTNs7'><span id='dTNs7'><b id='dTNs7'><form id='dTNs7'><ins id='dTNs7'></ins><ul id='dTNs7'></ul><sub id='dTNs7'></sub></form><legend id='dTNs7'></legend><bdo id='dTNs7'><pre id='dTNs7'><center id='dTNs7'></center></pre></bdo></b><th id='dTNs7'></th></span></q></dt></tr></i><div class="iutywm3" id='dTNs7'><tfoot id='dTNs7'></tfoot><dl id='dTNs7'><fieldset id='dTNs7'></fieldset></dl></div>
                    <legend id='dTNs7'><style id='dTNs7'><dir id='dTNs7'><q id='dTNs7'></q></dir></style></legend>
                    • <tfoot id='dTNs7'></tfoot>
                        <tbody id='dTNs7'></tbody>

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

                            主站蜘蛛池模板: 外贮压-柜式-悬挂式-七氟丙烷-灭火器-灭火系统-药剂-价格-厂家-IG541-混合气体-贮压-非贮压-超细干粉-自动-灭火装置-气体灭火设备-探火管灭火厂家-东莞汇建消防科技有限公司 | 减速机_上海宜嘉减速机| 小型手持气象站-空气负氧离子监测站-多要素微气象传感器-山东天合环境科技有限公司 | 小型手持气象站-空气负氧离子监测站-多要素微气象传感器-山东天合环境科技有限公司 | 电动葫芦|环链电动葫芦-北京凌鹰名优起重葫芦 | 涡街流量计_LUGB智能管道式高温防爆蒸汽温压补偿计量表-江苏凯铭仪表有限公司 | 泵阀展|阀门展|水泵展|流体机械展 -2025上海国际泵管阀展览会flowtech china | 齿轮减速电机一体机_蜗轮蜗杆减速马达-德国BOSERL齿轮减速机带电机生产厂家 | 油罐车_加油机_加油卷盘_加油机卷盘_罐车人孔盖_各类球阀_海底阀等车用配件厂家-湖北华特专用设备有限公司 | 六维力传感器_六分量力传感器_模腔压力传感器-南京数智微传感科技有限公司 | 黑田精工电磁阀-CAMMOZI气缸-ROSS电磁-上海茂硕机械设备有限公司 | 广东高华家具-公寓床|学生宿舍双层铁床厂家【质保十年】 | 环比机械| 百方网-百方电气网,电工电气行业专业的B2B电子商务平台 | 传递窗_超净|洁净工作台_高效过滤器-传递窗厂家广州梓净公司 | 派财经_聚焦数字经济内容服务平台 | PVC地板|PVC塑胶地板|PVC地板厂家|地板胶|防静电地板-无锡腾方装饰材料有限公司-咨询热线:4008-798-128 | 口信网(kousing.com) - 行业资讯_行业展会_行业培训_行业资料 | PVC地板|PVC塑胶地板|PVC地板厂家|地板胶|防静电地板-无锡腾方装饰材料有限公司-咨询热线:4008-798-128 | ETFE膜结构_PTFE膜结构_空间钢结构_膜结构_张拉膜_浙江萬豪空间结构集团有限公司 | 全自动包装秤_全自动上袋机_全自动套袋机_高位码垛机_全自动包装码垛系统生产线-三维汉界机器(山东)股份有限公司 | 档案密集架,移动密集架,手摇式密集架,吉林档案密集架-厂家直销★价格公道★质量保证 | 包装盒厂家_纸盒印刷_礼品盒定制-济南恒印包装有限公司 | 泰国试管婴儿_泰国第三代试管婴儿_泰国试管婴儿费用/多少钱_孕泰来 | 辐射仪|辐射检测仪|辐射巡测仪|个人剂量报警仪|表面污染检测仪|辐射报警仪|辐射防护网 | 青岛侦探调查_青岛侦探事务所_青岛调查事务所_青岛婚外情取证-青岛狄仁杰国际侦探公司 | 破碎机锤头_合金耐磨锤头_郑州宇耐机械工程技术有限公司 | 合肥礼品公司-合肥礼品定制-商务礼品定制公司-安徽柏榽商贸有限公司 | sfp光模块,高速万兆光模块工厂-性价比更高的光纤模块制造商-武汉恒泰通 | 昆明挖掘机修理厂_挖掘机翻新再制造-昆明聚力工程机械维修有限公司 | 拖鞋定制厂家-品牌拖鞋代加工厂-振扬实业中国高端拖鞋大型制造商 | 拉卡拉POS机官网 - 官方直营POS机办理|在线免费领取 | 佛山市钱丰金属不锈钢蜂窝板定制厂家|不锈钢装饰线条|不锈钢屏风| 电梯装饰板|不锈钢蜂窝板不锈钢工艺板材厂家佛山市钱丰金属制品有限公司 | 分类168信息网 - 分类信息网 免费发布与查询 | 手持式线材张力计-套帽式风量罩-深圳市欧亚精密仪器有限公司 | 苹果售后维修点查询,苹果iPhone授权售后维修服务中心 – 修果网 拼装地板,悬浮地板厂家,悬浮式拼装运动地板-石家庄博超地板科技有限公司 | 医养体检包_公卫随访箱_慢病随访包_家签随访包_随访一体机-济南易享医疗科技有限公司 | 油液红外光谱仪-油液监测系统-燃油嗅探仪-上海冉超光电科技有限公司 | 深圳美安可自动化设备有限公司,喷码机,定制喷码机,二维码喷码机,深圳喷码机,纸箱喷码机,东莞喷码机 UV喷码机,日期喷码机,鸡蛋喷码机,管芯喷码机,管内壁喷码机,喷码机厂家 | 爆破器材运输车|烟花爆竹运输车|1-9类危险品厢式运输车|湖北江南专用特种汽车有限公司 | 亚洲工业智能制造领域专业门户网站 - 亚洲自动化与机器人网 |