Closed JosiahParry closed 8 months ago
Taking a quick look now, looks good to me. Moving this into {arcgisutils}
should definitely reduce the complexity of arc_select()
! A couple of notes:
call
with this check: check_data_frame(item, allow_null = TRUE, call = call)
vctrs::vec_rbind()
, just pass to vctrs::list_drop_empty()
to drop the NULL elementsrbind_results
has an outdated reference to dplyr::bind_rows()
rbind_results()
(or maybe attach them as part of the attributes?). It adds some complexity to the object structure but could be worth doing for other reasons also, e.g. handling domain constraints.I think the inherits_or_null call should handle this but it did take some figuring out how to make sure this worked with tables, feature layers, and layers when returnGeometry was set to FALSE. There are also endpoints that return KML, XML, or other data types which this function would presumably not be able to handle.
Thank you very much for your feedback! I've modified the check_data_frame()
call so that the call is passed along with it as well as the arg
value. There is a new test for this as well.
I've fixed the documentation to reference vctrs::list_unchop()
and I've added an unused argument .ptype
to rbind_results()
that is reserved for a future time.
This PR adds a new function that takes a list of data.frames or sf objects and combines them as efficiently as possible.
Closes #38 Related https://github.com/R-ArcGIS/arcgislayers/pull/167
This helps us with the pattern described in #38. There are two points I want to make. One of the annoying bits of the Esri REST API endpoints is that errors are not returned as a status code, but rather, the error is captured in the json body.
Avoiding
httr2::resps_data()
httr2::resps_data()
is a useful function, however, it usesvctrs::list_unchop()
which is only marginally faster thando.call(rbind.data.frame, list())
whereascollapse::rowbind()
is orders of magnitude faster. The approach introduced in #42 will use collapse, data.table, vctrs, then base R to ensure the fastest approach is used. These are incompatible withhttr2::resps_data()
.Errors are not captured 400 codes
One challenging part of the ArcGIS location service endpoints is that errors are not returned as a 400 code. Instead, they are a json response with the error as plain text json.
The approach that I think might be most streamlined is this:
NULL
responses to add error information to the response as an attribute. How do we do this?This approach can be wrapped in another utility function similar to
resps_data()
something likearc_resps_data()
which would have a signature like so:The attribute
null_elements
returns the indices of the errors. Then each function can either return the requests / response or...something?@elipousson, would you mind reviewing if you have time?