Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug object world_geocoder not found without attaching package #23

Closed
ngoodkind opened this issue Jun 14, 2024 · 3 comments · Fixed by #24
Closed

bug object world_geocoder not found without attaching package #23

ngoodkind opened this issue Jun 14, 2024 · 3 comments · Fixed by #24

Comments

@ngoodkind
Copy link

Thanks for the package! I am encountering a bug when I try to use arcgisgeocode::geocode_addresses() without loading the entire library.

Function errors when the library is not attached.

arcgisutils::set_arc_token(token = arcgisutils::auth_key())

fp <- paste0(
  "https://urban-data-catalog.s3.amazonaws.com/",
  "drupal-root-live/2020/02/25/geocoding_test_data.csv"
)
to_geocode <- read.csv(fp)
arcgisgeocode::geocode_addresses(
  address = to_geocode$address,
  city = to_geocode$city,
  region = to_geocode$state,
  postal = to_geocode$zip
)
#> Error in has_custom_fields(geocoder): object 'world_geocoder' not found

Created on 2024-06-14 with reprex v2.1.0

Session info
sessionInfo()
#> R version 4.4.0 (2024-04-24)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 22.04.2 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so;  LAPACK version 3.10.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> time zone: America/Chicago
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] digest_0.6.35       R6_2.5.1            fastmap_1.1.1      
#>  [4] arcgisgeocode_0.1.0 xfun_0.43           magrittr_2.0.3     
#>  [7] rappdirs_0.3.3      glue_1.7.0          RcppSimdJson_0.1.11
#> [10] knitr_1.46          htmltools_0.5.8.1   rmarkdown_2.26     
#> [13] lifecycle_1.0.4     cli_3.6.2           reprex_2.1.0       
#> [16] withr_3.0.0         compiler_4.4.0      rstudioapi_0.16.0  
#> [19] tools_4.4.0         curl_5.2.1          evaluate_0.23      
#> [22] Rcpp_1.0.12         httr2_1.0.1         yaml_2.3.8         
#> [25] arcgisutils_0.3.0   rlang_1.1.3         fs_1.6.4

Function works when library is attached

library(arcgisgeocode)

arcgisutils::set_arc_token(token = arcgisutils::auth_key())

fp <- paste0(
  "https://urban-data-catalog.s3.amazonaws.com/",
  "drupal-root-live/2020/02/25/geocoding_test_data.csv"
)
to_geocode <- read.csv(fp)
geocoded <- geocode_addresses(
  address = to_geocode$address,
  city = to_geocode$city,
  region = to_geocode$state,
  postal = to_geocode$zip
)

 dplyr::glimpse(geocoded[1:5, 1:10])
#> Rows: 5
#> Columns: 11
#> $ result_id   <int> 4, 1, 5, 6, 2
#> $ loc_name    <chr> "World", "World", "World", "World", "World"
#> $ status      <chr> "M", "M", "M", "M", "M"
#> $ score       <dbl> 100, 100, 100, 100, 100
#> $ match_addr  <chr> "500 L'Enfant Plz SW, Washington, District of Columbia, 20…
#> $ long_label  <chr> "500 L'Enfant Plz SW, Washington, DC, 20024, USA", "200 K …
#> $ short_label <chr> "500 L'Enfant Plz SW", "200 K St NE", "500 L'Enfant Plz SW…
#> $ addr_type   <chr> "PointAddress", "PointAddress", "PointAddress", "PointAddr…
#> $ type_field  <chr> NA, NA, NA, NA, NA
#> $ place_name  <chr> NA, NA, NA, NA, NA
#> $ geometry    <POINT [°]> POINT (-77.02358 38.88326), POINT (-77.00304 38.90277), PO…

Created on 2024-06-14 with reprex v2.1.0

Session info
sessionInfo()
#> R version 4.4.0 (2024-04-24)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 22.04.2 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so;  LAPACK version 3.10.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> time zone: America/Chicago
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] arcgisgeocode_0.1.0
#> 
#> loaded via a namespace (and not attached):
#>  [1] dplyr_1.1.4         compiler_4.4.0      tidyselect_1.2.1   
#>  [4] reprex_2.1.0        Rcpp_1.0.12         RcppSimdJson_0.1.11
#>  [7] yaml_2.3.8          fastmap_1.1.1       R6_2.5.1           
#> [10] generics_0.1.3      curl_5.2.1          classInt_0.4-10    
#> [13] httr2_1.0.1         sf_1.0-16           knitr_1.46         
#> [16] arcgisutils_0.3.0   tibble_3.2.1        units_0.8-5        
#> [19] DBI_1.2.2           pillar_1.9.0        rlang_1.1.3        
#> [22] utf8_1.2.4          xfun_0.43           fs_1.6.4           
#> [25] cli_3.6.2           withr_3.0.0         magrittr_2.0.3     
#> [28] class_7.3-22        digest_0.6.35       grid_4.4.0         
#> [31] rstudioapi_0.16.0   rappdirs_0.3.3      lifecycle_1.0.4    
#> [34] vctrs_0.6.5         KernSmooth_2.23-22  proxy_0.4-27       
#> [37] evaluate_0.23       glue_1.7.0          fansi_1.0.6        
#> [40] e1071_1.7-14        rmarkdown_2.26      tools_4.4.0        
#> [43] pkgconfig_2.0.3     htmltools_0.5.8.1
@JosiahParry
Copy link
Collaborator

Thanks for the report! I can reproduce this. Give me a little bit to figure this out :)

@JosiahParry
Copy link
Collaborator

This is because I needed to set internal = TRUE in use_data() see https://r-pkgs.org/data.html#sec-data-sysdata.

Going to make a test and push this to main so a new version can be built. Thank you very much

@JosiahParry
Copy link
Collaborator

Please try downloading a new version in about an hour from: https://r-arcgis.r-universe.dev/arcgisgeocode

The binaries should be built by then and contain the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants