R-ArcGIS / arcgisgeocode

Utilize public or private ArcGIS Geocoder Services from R. Provides reverse geocoding, candidate search, single address, and batch geocoding.
http://r.esri.com/arcgisgeocode/
Apache License 2.0
40 stars 6 forks source link

Error in UseMethod("st_as_sf"): method not applicable to 'st_as_sf' applied to an object of class 'list' #13

Closed mixedlogit closed 7 months ago

mixedlogit commented 7 months ago

Hi Josiah,

As a I mentioned in our previous talk, I'm running the function find_address_candidates() for some addresses, and I get the following error: Error in UseMethod("st_as_sf"): method not applicable to 'st_as_sf' applied to an object of class 'list' (I translated cause the og is in Portuguese). Below follows the code I'm using:

# Geocode -----
library(arcgisgeocode)

data <- read.csv(file = 'data.csv')

data.geocode <- find_address_candidates(
  single_line = data$end,
  max_locations = 1)`

I'm not using the sf package in my code. I'm uploading a sample that is generating the problem data.csv

Also, follow the session info:

`R version 4.3.3 (2024-02-29 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 11 x64 (build 22631)

Matrix products: default

locale: [1] LC_COLLATE=Portuguese_Brazil.utf8 LC_CTYPE=Portuguese_Brazil.utf8 LC_MONETARY=Portuguese_Brazil.utf8 [4] LC_NUMERIC=C LC_TIME=Portuguese_Brazil.utf8

time zone: America/Sao_Paulo tzcode source: internal

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] arcgisgeocode_0.0.0.9003

loaded via a namespace (and not attached): [1] R6_2.5.1 collapse_2.0.13 cellranger_1.1.0 readxl_1.4.3 e1071_1.7-14
[6] magrittr_2.0.3 rappdirs_0.3.3 glue_1.7.0 KernSmooth_2.23-22 parallel_4.3.3
[11] lifecycle_1.0.4 classInt_0.4-10 cli_3.6.2 sf_1.0-16 grid_4.3.3
[16] DBI_1.2.2 proxy_0.4-27 class_7.3-22 compiler_4.3.3 rstudioapi_0.16.0
[21] tools_4.3.3 curl_5.2.1 httr2_1.0.1 Rcpp_1.0.12 arcgisutils_0.2.0.9000 [26] rlang_1.1.3 units_0.8-5 `

JosiahParry commented 7 months ago

This is very helpful. Thank you very much. I can reproduce this error.

JosiahParry commented 7 months ago

This should be fixed by https://github.com/R-ArcGIS/arcgisutils/commit/2a377324b4c509d6775bf35375ecd4b25c665fd0