Problem trying to download with occ_dowloand (rgbif)

Hi everyone!
I’m trying to download a fairly large polygon database, I’ve briefly read the manual for the rgbif package, however I can’t find a solution.
My code is the following:

occ_download(geometry = “POLYGON((-76.99487 -12.19878,-76.9968 -12.19702,-76.99809 -12.19847,-76.9967 -12.19974,-76.99361 -12.20288,-76.9939 -12.2031,-76.99489 -12.20393,-76.99738 -12.2016,-76.99866 -12.20289,-76.9969 -12.2049,-76.99639 -12.20452,-76.99583 -12.20511,-76.99677 -12.20622,-76.99661 -12.20644,-76.99755 -12.20755,-76.99746 -12.20834,-76.99745 -12.20915,-76.99711 -12.20947,-76.99658 -12.21021,-76.9963 -12.21052,-76.99587 -12.21089,-76.9955 -12.21115,-76.99495 -12.21143,-76.99318 -12.21222,-76.99207 -12.21352,-76.99201 -12.21395,-76.99198 -12.21465,-76.99211 -12.21534,-76.99227 -12.21572,-76.99245 -12.21604,-76.99257 -12.21634,-76.9926 -12.21643,-76.99271 -12.21696,-76.99272 -12.21746,-76.99268 -12.21794,-76.99258 -12.21818,-76.9924 -12.21856,-76.99222 -12.21884,-76.99196 -12.21916,-76.98969 -12.22149,-76.98923 -12.22196,-76.98899 -12.22225,-76.98896 -12.22261,-76.98907 -12.22286,-76.98917 -12.22299,-76.98995 -12.22397,-76.98762 -12.22512,-76.98577 -12.22585,-76.98422 -12.22656,-76.97839 -12.21892,-76.97964 -12.21768,-76.9817 -12.21558,-76.98294 -12.2143,-76.98335 -12.21391,-76.98363 -12.21356,-76.98744 -12.20968,-76.99138 -12.20566,-76.99106 -12.20547,-76.99067 -12.2052,-76.99051 -12.20507,-76.99055 -12.20493,-76.99117 -12.20368,-76.992 -12.20167,-76.99208 -12.20151,-76.99243 -12.20104,-76.99293 -12.20052,-76.99487 -12.19878))”, format = “DWCA”, user = ‘xxxxx’, pwd = ‘xxxxx’, email = ‘xxxxx@gmail.com’)

The result I get from R is:
Error: all inputs must be class occ_predicate/occ_predicate_list; ?occ_download

Hi there,

I believe the correct syntax would be something like this:

occ_download(pred_within(“POLYGON((-76.99487 -12.19878,-76.9968 -12.19702,-76.99809 -12.19847,-76.9967 -12.19974,-76.99361 -12.20288,-76.9939 -12.2031,-76.99489 -12.20393,-76.99738 -12.2016,-76.99866 -12.20289,-76.9969 -12.2049,-76.99639 -12.20452,-76.99583 -12.20511,-76.99677 -12.20622,-76.99661 -12.20644,-76.99755 -12.20755,-76.99746 -12.20834,-76.99745 -12.20915,-76.99711 -12.20947,-76.99658 -12.21021,-76.9963 -12.21052,-76.99587 -12.21089,-76.9955 -12.21115,-76.99495 -12.21143,-76.99318 -12.21222,-76.99207 -12.21352,-76.99201 -12.21395,-76.99198 -12.21465,-76.99211 -12.21534,-76.99227 -12.21572,-76.99245 -12.21604,-76.99257 -12.21634,-76.9926 -12.21643,-76.99271 -12.21696,-76.99272 -12.21746,-76.99268 -12.21794,-76.99258 -12.21818,-76.9924 -12.21856,-76.99222 -12.21884,-76.99196 -12.21916,-76.98969 -12.22149,-76.98923 -12.22196,-76.98899 -12.22225,-76.98896 -12.22261,-76.98907 -12.22286,-76.98917 -12.22299,-76.98995 -12.22397,-76.98762 -12.22512,-76.98577 -12.22585,-76.98422 -12.22656,-76.97839 -12.21892,-76.97964 -12.21768,-76.9817 -12.21558,-76.98294 -12.2143,-76.98335 -12.21391,-76.98363 -12.21356,-76.98744 -12.20968,-76.99138 -12.20566,-76.99106 -12.20547,-76.99067 -12.2052,-76.99051 -12.20507,-76.99055 -12.20493,-76.99117 -12.20368,-76.992 -12.20167,-76.99208 -12.20151,-76.99243 -12.20104,-76.99293 -12.20052,-76.99487 -12.19878))”),user=’’,pwd=’’,email=’’)

The above worked for me in this download: https://doi.org/10.15468/dl.5d8wx6

2 Likes

Thanks for answering @dnoesgaard - That’s correct.

@urieltszev12 That’s the old syntax for an older version of rgbif. I’d recommend installing the latest version of rgbif if you don’t have it.

See the download predicates dsl page for help on the various download predicate builders.

You can also try occ_download_prep() which doesn’t execute a download query, but prepares the query just as it would for a real download request - and you can make sure you’ve structured your query correctly

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.