闪亮的传单地图弹出窗口正在拉错数据

时间:2016-09-21 16:03:09

标签: r leaflet shiny shiny-server

出于某种原因,分配给Shiny活页应用上的多边形的弹出窗口正在提取应分配给多边形的错误信息。似乎多边形已放置在地图上,然后以不同的顺序分配多边形属性。

非常感谢任何想法。

server<-function(input,output,session)({

  output$map<-renderLeaflet({
    leaflet() %>%
        addTiles() %>%
        addPolygons(data = spatial_merge, 
          layerId = spatial_merge@data$PolygonNo, 
          stroke= TRUE, fillOpacity = 0.5, smoothFactor = 0.5,     weight=1,
          color = "grey", opacity = 1, popup=paste(sep= "<br/>",
               "<b>ForestName: </b>", spatial_merge$ForestName,
               "<b>Project Name: </b>", spatial_merge$Project_Name,
               "<b>Treatment Year: </b>", spatial_merge$Project_Year,
               "<b>Treatment Type: </b>", spatial_merge$Treatment_Type,
               "<b>Area Treated: </b>", spatial_merge$Polygon_Area,
               "<b>Polygon Cost: </b>", spatial_merge$TotalCost,
               "<b>Contractor Name: </b>", spatial_merge$Project_Contractor)
  })
})    

shinyApp(ui,server)

> class(spatial_merge)
[1] "SpatialPolygonsDataFrame"
attr(,"package")
[1] "sp"

> names(spatial_merge)
 [1] "Primary_Key"        "Project_Name"       "PolygonNo"          "WMA"                    "ContractName"       "Project_Year"      
 [7] "Treatment_Type"     "Project_Contractor" "Polygon_Area"           "TotalCost"          "OBJECTID_12"        "FA_NAME"           
[13] "Comments"           "Source"             "DataCaptureDate"        "DataCapturedBy"     "Block_ID"           "SubBlock_ID"       
[19] "SHAPE_Length"       "SHAPE_Area"   

> dim(spatial_merge)
[1] 647  20

感谢您查看我的问题! ķ

0 个答案:

没有答案