AtlasOfLivingAustralia / galah-R

Query living atlases from R
https://galah.ala.org.au
38 stars 3 forks source link

Error in parse_url(status$statusUrl) : length(url) == 1 is not TRUE #157

Closed CJRzzZ closed 1 year ago

CJRzzZ commented 1 year ago

Describe the bug The request using atlas_occurrences() doesn't work on my local machine. It used to work well, but when I ran this code this morning, it gave the error. I am not sure if the updates on R packages cause the problem.

galah version 1.4.0

To Reproduce Steps to reproduce the behaviour:

> repo_dir = getwd() > result <- galah_call() |> + galah_filter(kingdom == 'Fungi'| kingdom == 'Animalia')|> +
+ galah_select(basisOfRecord,institutionCode,year,month,day,taxonRank, + individualCount,occurrenceStatus,occurrenceRemarks,decimalLatitude, + decimalLongitude, coordinateUncertaintyInMeters,scientificName, + kingdom,phylum,class,order,family,genus,species,dataResourceUid ,eventDate,vernacularName, recordedBy,identifiedBy, group = "basic")|> + galah_geolocate(st_read(paste(repo_dir, "/Shapefiles/radius/Parkville_w__1_5km/8910627.shp", sep="")))|> + atlas_occurrences() Reading layer 8910627' from data source C:\Users\10951\Documents\GitHub\Biodiversity-Baseline-Data-Project->group23\Shapefiles\radius\Parkville_w__1_5km\8910627.shp' using driver `ESRI Shapefile' Simple feature collection with 1 feature and 2 fields Geometry type: POLYGON Dimension: XY Bounding box: xmin: 144.9442 ymin: -37.81126 xmax: 144.9782 ymax: -37.78431 Geodetic CRS: WGS84(DD) This query will return 159500 records Error in parse_url(status$statusUrl) : length(url) == 1 is not TRUE

Expected behaviour No error and return the data object.

daxkellie commented 1 year ago

Thanks for letting us know about this error. Without your shapefile I can't reproduce this exact code on my machine, but in the tests that I have run, things seem to be working for me.

The error message suggests that {galah} isn't able to build a url with the information you have given it, but considering this worked for you before, it might have been due to a random outage with the ALA.

Just to make sure, would you be able to restart your R session and try running your code again?

CJRzzZ commented 1 year ago

This afternoon I tried to run my code again and it works well. Thanks for your help!

mjwestgate commented 1 year ago

This error got caught by CRAN as well; although difficult to reproduce, it's a violation of their rule that:

Packages which use Internet resources should fail gracefully with an informative message if the resource is not available or has changed (and not give a check warning nor error).

I'll have a look at this and see if I can't replace it with a clearer message.

mjwestgate commented 1 year ago

This section of code has since been completely rewritten; as of v 1.5.1 it is in url_queue.R and has more checks to avoid related problems