Skip to content

Instantly share code, notes, and snippets.

@mtreg
Created May 7, 2019 02:46
Show Gist options
  • Save mtreg/b7f2734aa76db5d6700a6032e40ba561 to your computer and use it in GitHub Desktop.
Save mtreg/b7f2734aa76db5d6700a6032e40ba561 to your computer and use it in GitHub Desktop.
Automate download of orthoimagery tiles from NY GIS Clearinghouse via R
# Based on helpful example here: http://felixfan.github.io/download-files/
# Regular NY Download page here: http://gis.ny.gov/gateway/mg/2018/new_york_city/18ic_c_new_york_city_l06_4bd.htm
url = "ftp://ftp.gis.ny.gov/ortho/nysdop9/new_york_city/spcs/tiles/"
filenames = getURL(url, ftp.use.epsv = FALSE, dirlistonly = TRUE)
filenames <- strsplit(filenames, "\r\n")
filenames = unlist(filenames)
filenames
for (filename in filenames) {
download.file(paste(url, filename, sep = ""), paste("E:/nyc_ortho_2018", "/", filename,
sep = ""))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment