Last active
June 20, 2019 08:17
-
-
Save gtm19/d3f57b88c7d496cb76be768eb76ca8e3 to your computer and use it in GitHub Desktop.
Example code to download shapefile from NSIDC website
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(sf) | |
url <- "ftp://sidads.colorado.edu/DATASETS/NOAA/G02135/north/monthly/shapefiles/shp_extent/12_Dec/extent_N_201012_polygon_v3.0.zip" | |
tempdir <- tempdir(check = TRUE) | |
tempfile <- tempfile() | |
download.file(url, tempfile, mode = "wb") | |
unzipped <- unzip(tempfile, exdir = tempdir) | |
sf <- read_sf(unzipped[grepl(".shp$", unzipped)]) %>% | |
summarise() | |
unlink(tempdir, recursive = TRUE, force = TRUE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment