dickoa / rhdx

R package to interact with the Humanitarian Data Exchange portal - http://dickoa.gitlab.io/rhdx/
Other
26 stars 6 forks source link

get_resource_layers() problem #4

Closed andysouth closed 4 years ago

andysouth commented 4 years ago

Hi Ahmadou,

I'm trying to get the number of layers in a resource and I get this error.

pull_dataset("administrative-boundaries-cod-mli") %>%
     get_resource(3) %>%
     get_resource_layers()

Error in self$download(folder = download_folder, quiet = quiet_download, : formal argument "folder" matched by multiple actual arguments

I suspect this may be due to argument being specified as folder and download_folder (but I'm not big on these class things).

To show that getting the first layer of the resource does work:

pull_dataset("administrative-boundaries-cod-mli") %>%
              get_resource(3) %>%
              read_resource(download_folder=getwd()) -> malishp

    plot(sf::st_geometry(malishp))
dickoa commented 4 years ago

Hi Andy,

Thanks a lot for bringing this to my attention. I pushed a quick fix, let me know if it's working now.

Ahmadou

andysouth commented 4 years ago

Thankyou ! This does now work.

(but it seems that the man page for get_resource_layers still has the arg as folder.)

pull_dataset("administrative-boundaries-cod-mli") %>%
     get_resource(3) %>%
     get_resource_layers(download_folder=tempdir())

Driver: ESRI Shapefile Available layers: layer_name geometry_type features fields 1 mli_admbnda_adm0_1m_dnct_20190802 Polygon 1 10 2 mli_admbnda_adm1_1m_dnct_20190802 Polygon 9 12 3 mli_admbnda_adm2_1m_dnct_20190802 Polygon 50 14 4 mli_admbnda_adm3_1m_dnct_20190802 Polygon 701 17 5 mli_admbndl_admALL_1m_dnct_itos_20190802 Line String 2039 5

dickoa commented 4 years ago

Oups, I forgot to generate Rd files, just pushed the update docs. I really appreciate your feedback. Thanks again

andysouth commented 4 years ago

No worries, I've been there ;-) Thanks.