Skip to content
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

More covariates download #4

Open
timcdlucas opened this issue Feb 5, 2024 · 8 comments
Open

More covariates download #4

timcdlucas opened this issue Feb 5, 2024 · 8 comments

Comments

@timcdlucas
Copy link

No description provided.

@simon-smart88
Copy link
Owner

Was this about adding more covariates or about improving load times by downloading them to the server (where licences permit)

@timcdlucas
Copy link
Author

I was referring to just accessing more different covariates. So long term aim.

@simon-smart88
Copy link
Owner

Thanks. Ones on my radar and in various states of readiness are vegetation (fcover), air pollution and african rainfall (CHIRPS). Anything else?

@timcdlucas
Copy link
Author

Uuuuh, can't remember what we've said before. But nightlights, land-use, human footprint could all be useful. I've got a pdf of geospatial variables that DHS use that might be a useful reference.

Also some derived variables like "distance to national border" and "distance to water" could be useful. But again, way in the future.

@simon-smart88
Copy link
Owner

Yes I remember that doc but not sure I have a copy. Nightlight and land use are already included, land use includes a built-up layer - is that the same as human footprint? https://www.arcgis.com/home/item.html?id=46cbfa5ac94743e4933b6896f1dcecfd might be a good source for the distance to water - they've released a new R package which should make it easier to incorporate. The downside is needing to authenticate which makes things less user-friendly for local use (this is already an issue for the nightlight data).

@simon-smart88
Copy link
Owner

@timcdlucas

Accessing distance to water was pretty simple in the end. Tokens are stored as environment variables like for nightlights but it should be okay for users to provide them as inputs if they are running locally, but I do need to look into the security of that. The free ArcGIS account will probably suffice (at least for now).

library(arcgis)
library(terra)
library(disagapp)

shpdf <- data.frame(datapath = list.files(system.file("extdata/shapes", package="disagapp"), full.names = TRUE),
                    name = list.files(system.file("extdata/shapes", package="disagapp")))
shape <- resp_shape(shpdf)

token <- auth_client()
set_arc_token(token)

furl <- "https://landscape6.arcgis.com/arcgis/rest/services/World_Distance_to_Surface_Water/ImageServer"

flayer <- arc_open(furl)

bbox <- sf::st_bbox(shape)

ras <- arc_raster(flayer, xmin = bbox[[1]], xmax = bbox[[3]], ymin = bbox[[2]], ymax = bbox[[4]], crs = sf::st_crs(shape))

ras <- clamp(ras, upper = 300, value = FALSE)

plot(ras)

@simon-smart88
Copy link
Owner

@timcdlucas Do you think this is worth having: https://dataforgood.facebook.com/dfg/tools/relative-wealth-index there's a package for interacting with their API so it shouldn't be too difficult to integrate: https://gitlab.com/dickoa/rhdx

@timcdlucas
Copy link
Author

Yes definitely. I've been meaning to integrate something like this to my general mapping workflow for ages. Some of it doesn't look quite right to me (China looks lower on average than India for example). And lots of it will be driven by night lights (you can see cities pop out). But yes still definitely useful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants