-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using geodata::gadm
with geotargets
#22
Comments
(Following up a discussion with @njtierney) ... it's feasible to avoid explicit download with vsicurl library(terra)
vect("/vsicurl/https://geodata.ucdavis.edu/gadm/gadm4.1/gpkg/gadm41_CRI.gpkg", "ADM_ADM_1")
class : SpatVector
geometry : polygons
dimensions : 7, 11 (geometries, attributes)
extent : -87.10185, -82.55232, 5.49857, 11.21976 (xmin, xmax, ymin, ymax)
source : gadm41_CRI.gpkg (ADM_ADM_1)
coord. ref. : lon/lat WGS 84 (EPSG:4326)
names : GID_1 GID_0 COUNTRY NAME_1 VARNAME_1 NL_NAME_1
type : <chr> <chr> <chr> <chr> <chr> <chr>
values : CRI.1_1 CRI Costa Rica Alajuela NA NA
CRI.2_1 CRI Costa Rica Cartago NA NA
CRI.3_1 CRI Costa Rica Guanacaste NA NA
TYPE_1 ENGTYPE_1 CC_1 HASC_1 ISO_1
<chr> <chr> <chr> <chr> <chr>
Provincia Province 2 CR.AL CR-A
Provincia Province 3 CR.CA CR-C
Provincia Province 5 CR.GU CR-G
That might provide a better ux. There are zipped GPKG with every country in them, but not as efficient to read with a query. I might make some suggestions to geodata. But another option is with CGAZ geoboundaries: ## there are ADM1 and ADM2 levels also
dsn <- "/vsizip//vsicurl/https://github.com/wmgeolab/geoBoundaries/raw/main/releaseData/CGAZ/geoBoundariesCGAZ_ADM0.zip"
vect(dsn, query = "SELECT * FROM geoBoundariesCGAZ_ADM0 WHERE shapeGroup IN ('AUS','NZL')")
class : SpatVector
geometry : polygons
dimensions : 2, 3 (geometries, attributes)
extent : -178.9278, 179.0695, -54.76208, -8.538777 (xmin, xmax, ymin, ymax)
source : geoBoundariesCGAZ_ADM0.zip
coord. ref. : lon/lat WGS 84 (EPSG:4326)
names : shapeGroup shapeType shapeName
type : <chr> <chr> <chr>
values : AUS ADM0 Australia
NZL ADM0 New Zealand
|
Thanks for this @mdsumner ! I think that overall from this we can address this issue in a vignette, by detailing how we would encourage people to use geotargets for things like this. Using the |
Ok, finally getting this as I'm using |
geodata::gadm
is commonly used to get shapefiles for countries at various levels of boundaries.This issue is to talk about how to use gadm within geotargets - related to #5.
Some code to download a country shapefile might be something like:
My question is how should we recommend that users implement and use something like this in a targets workflow? At this stage I haven't tested this code out with the latest version of {geotargets} so it might all just work, but my specific concerns are around:
Also porting in @brownag 's comment from #5 in here as it is relevant:
The text was updated successfully, but these errors were encountered: