SSA-Statistical-Team-Projects / GeoLink

GeoLink package
0 stars 1 forks source link

geolink_buildings() #26

Open dasalm20 opened 1 month ago

dasalm20 commented 1 month ago
  1. When running the code below using v1.1 of buildings data for "NGA", it takes a very long time, 14 rasters, but returned a dataframe with no observations. But when using v2.0, the code runs very fast. What I am confused about is that "NGA" is listed in the v1.1 url , but not in the v2.0. I checked the README file and it is probably out of date as NGA seems to be empty, but does not explain why we get all observations as missing for "NGA" in v01.1 and not v2.0 : https://data.worldpop.org/repo/wopr/_MULT/buildings/v2.0/XXX_buildings_v2_0_README.pdf

  2. When using v02.0: Function downloads multiple rasters , 4 in total, and creates only one column named “buildings_” . I am not sure if this column is the count, cv, urban or length.

test_dt <- geolink_buildings(version = "v2.0", iso_code = "NGA", shp_dt = shp_dt[shp_dt$ADM1_PCODE == "NG001",])

  1. When using a survey, I get the following error: Error in unclass(x)[i] : invalid subscript type 'list'

Code : test_dt <- geolink_buildings(version = "v1.1", iso_code = "NGA", survey_dt = st_as_sf(hhgeo_dt[1:10], crs = 4326), buffer_size = 1000)

ifeanyi588 commented 3 weeks ago

I have fixed this! @dasalm20 please confirm as per our discussion yesterday.

DianaJaganjac commented 3 weeks ago

@ifeanyi588 @dasalm20 I am working on this now, is it fixed?

DianaJaganjac commented 3 weeks ago

Hi @dasalm20 @ifeanyi588 , I could not find any updated code in the other branches. I have now fixed this and the buildings function outputs the following columns in the output df:

image

@dasalm20 Also, the user will need to check and know which version to use, for example on the WorldPop website NGA only has data for version 1.1 and not for version 2.0.

Please, test again and let me know if there are any issues.

dasalm20 commented 3 weeks ago

Hi @DianaJaganjac,

When I run the survey test :

surv_test <- geolink_buildings(version = "v1.1", iso_code = "NGA", survey_dt = st_as_sf(hhgeo_dt[1:50], crs = 4326), shp_dt = NULL, buffer_size = 1000)

I get this error : Error: Your dataset is missing an existing CRS definition. Either assign an appropriate CRS to your dataset or find one with the crsuggest::guess_crs() function.

Can you try running it to see of you get the same error?

When I ran the code for a shapefile:

It returned a column called "buildings_", is that the expected output? or should it be "buildings_year" or "buildings_mean"

DianaJaganjac commented 3 weeks ago

@dasalm20 I just pushed the latest code, try now again.

dasalm20 commented 3 weeks ago

Hi @DianaJaganjac,

I ran the code on the geolink_updates() and i still got this error when using a survey:

Error: Your dataset is missing an existing CRS definition. Either assign an appropriate CRS to your dataset or find one with the crsuggest::guess_crs() function.

If you are using a code that works, please share it with me, perhaps I am missing an argument

code: surv_test <- geolink_buildings(version = "v1.1", iso_code = "NGA", survey_dt = st_as_sf(hhgeo_dt[1:50], crs = 4326), shp_dt = NULL, buffer_size = 1000)