I have a shape file, and I want to post it on top of a google map with ggplot, but posting via geom_polygon(ggplot2) shows lines that do not make sense
my code:
######## the shape file ftp://geoftp.ibge.gov.br/organizacao_do_territorio/malhas_territoriais/malhas_municipais/municipio_2015/Brasil/BR/
download.file("ftp://geoftp.ibge.gov.br/organizacao_do_territorio/malhas_territoriais/malhas_municipais/municipio_2015/Brasil/BR/br_municipios.zip",temp)
data <- unz(temp, "BRMUE250GC_SIR.shp")
data.shape<-st_read(data)
####### the map from ggmap
mapa_edital_guarulhos <- get_map(location="GUARULHOS-SP",zoom=11,color = "bw",
maptype = "roadmap")
mapa_edital_guarulhos_01<- ggmap(mapa_edital_guarulhos)
########## plotting with ggplot
mapa_edital_guarulhos1 <- mapa_edital_guarulhos_01 +
geom_polygon(aes(x=long,y=lat, group=group), data=shape.sp,
color='black',alpha=0)
The result:
The arrow shows lines that do not make sense in my plot, plotting only the shape for the same interval:
plot(shape.sp,xlim=c(-47.25,-46.95),ylim=c(-23.1,-22.7))
whats is the problem in my code? thanks