library(tidyverse)
library(sf)
points <- read_csv("points.csv") %>%
st_as_sf(coords=c("lat","long"),
crs="+init=epsg:4326")
#choose website frm where you want to download data from
#ftp = "ftp://geoftp.ibge.gov.br/organizacao_do_territorio/malhas_territoriais/malhas_municipais/municipio_2010/"
#choose sulffix for the link
#to understand what is happening, try to run this link:
# ftp://geoftp.ibge.gov.br/organizacao_do_territorio/malhas_territoriais/malhas_municipais/municipio_2010/ac
#estados <- c("ac", "al", "am", "ap", "ba", "ce", "df", "es", "go", "ma", "mg",
# "ms", "mt", "pa", "pb", "pe", "pi", "pr", "rj", "rn", "ro", "rr",
# "rs", "sc", "se", "sp", "to")
##download
#for (e in estados){
# download.file(paste0(ftp,e,"/", e, "_municipios.zip"),paste0(e,"_municipios.zip"))
#}
#
##unzip
#for (e in estados){
# unzip(paste0(dldir, e,"_municipios.zip"))
#}
#files where saved to your wor