R,Leaflet - Radius Overlapping Polygon

时间:2016-07-27 16:03:29

标签: r leaflet overlap polygons radius

我在R中有一个应用程序,我想知道距离质心X米的半径是否与特定多边形重叠。因此,我的想法是,如果我点击多边形,应用程序将显示哪些对象的半径与多边形重叠: enter image description here

任何想法都会非常有帮助。我觉得我需要比较我带入的形状文件中的坐标到质心加半径。我想也许光栅库中的交叉方法可以解决问题,但是,当我查看文档时,我觉得我不知道如何让它读取形状文件或质心加半径。 / p>

我的代码如下:

library(rgdal)
library(leaflet)

zone_file <- readOGR("ZONE_ARC_MAP_OBJECT/Shape/ZoneRTest.shp", layer = "ZoneRTest")
mpo_overall <- read.csv("MPOEVI_OVERALL_TEST.csv")
mpo_zip <- read.csv("MPOEVI_ZIP_TEST.csv")
    leaflet(zone_file) %>%
      addTiles() %>% 
      addCircles(lng = mpo_overall$LONGITUDE, lat = mpo_overall$LATITUDE, radius = mpo_overall$RADIUS,
             popup = paste(mpo_overall$TOTAL_ORDERS)) %>%
      addPolygons(data = zone_file, fill = TRUE, stroke = TRUE, fillOpacity = 0.1,
              color = ifelse(zone_file$ZONEONTIME >=.92, 'green', 
                             ifelse(zone_file$ZONEONTIME >=.82, 'orange', 'red')),
              smoothFactor = 0.9,
              #stroke = TRUE, fillOpacity = 0.2, smoothFactor = 0.5,
              popup = paste("Zone: ", zone_file$OBJECTID, "<br>",
                            "Total Orders: ", zone_file$ZONETOTALO, "<br>",
                            "On-Time%: ", zone_file$ZONEONTIME, "<br>",
                            "Revenue: ", zone_file$ZONEREVENU))

0 个答案:

没有答案