0

我正在尝试重现代码以在另一台计算机的地图中显示多边形,但是,在一台计算机中未显示多边形。有人在共享代码时遇到过这种问题吗?您可以从这里下载 shapefile: http: //www.conabio.gob.mx/informacion/metadata/gis/muni_2012gw.xml? _xsl=/db/metadata/xsl/fgdc_html.xsl&_indent=no

library(rgdal)
library(rgeos)
library(leaflet)

Mex <- readOGR(dsn="C:/DISCO D", layer="Muni_2012gw")
Mex_sub <- Mex[Mex$CVE_ENT=="01",]



bins <- quantile(Mex_sub@data$OID_1, c(0,.125,.25, .5, .75,.875, 1))
pal <- colorBin("YlOrRd", domain = Mex_sub@data$OID_1, bins = (bins),
                na.color = "grey40", reverse = FALSE)

centr <- gCentroid(Mex_sub)@coords
leaflet(Mex_sub, options = leafletOptions(minZoom = 4, maxZoom = 15)) %>% 
  addTiles() %>%
  setView(centr[1], centr[2], zoom = 8) %>%
  addPolygons(data=Mex_sub, weight = 1,fill = ~OID_1, fillColor = ~pal(OID_1),
              opacity=1, fillOpacity = 0.5, color=grey(0.5))

我电脑里的地图

在另一台计算机上映射

4

0 回答 0