Created
July 13, 2023 14:56
-
-
Save mtreg/12bb5588c0fa3d5ab12615979c0feae0 to your computer and use it in GitHub Desktop.
Load layer from gpkg in zipped folder within a Zenodo repository directly into R
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
# Example of loading data from gpkg in zipped folder on Zenodo into R | |
# Data from the repository 'The State of the Urban Forest in New York City - Supplemental Datasets' | |
# at https://zenodo.org/record/5210261 | |
# Load sf package | |
library(sf) | |
# URL to Files on Zenodo | |
vurl <- "/vsizip//vsicurl/https://zenodo.org/record/5210261/files/canopy_streettree_summaries.zip/canopystreettree_supp.gpkg" | |
# Get layer names for next step | |
st_layers(vurl) | |
# Read in Layer by name | |
x <- st_read(vurl, "canopystreettree_supp_boro") | |
# Read in Layer by where it is in the vector of names from st_layers | |
x2 <- st_read(vurl, st_layers(vurl)$name[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment