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

Geocoding with google no longer returning results (API change?) #199

Open
carlosyanez opened this issue Feb 3, 2025 · 6 comments
Open
Labels
bug Something isn't working

Comments

@carlosyanez
Copy link

carlosyanez commented Feb 3, 2025

Hi,

Thanks for creating this package! I've been using it monthly to pull data from Google via its API. Until last month, everything has been working OK, until this month, where it stopped returning results:
tibble(addr="Av. España 1680, Valparaíso, Chile") |>
geocode(address = addr, method="google",
full_results=TRUE)Passing 1 address to the Google single address geocoder
[===================================================================================================================] 1/1 (100%) Elapsed: 0s Remaining: 0s
# A tibble: 1 × 3 addr lat long
<chr> <dbl> <dbl>1 Av. España 1680, Valparaíso, Chile NA NA

This code has not changed from the last use. Could this be a change in the API?

Thanks,
Carlos

@carlosyanez carlosyanez added the bug Something isn't working label Feb 3, 2025
@carlosyanez carlosyanez changed the title Geocoding with google no longer returning results (API change) Geocoding with google no longer returning results (API change?) Feb 3, 2025
@jessecambon
Copy link
Owner

Hi @carlosyanez, I haven't used the Google API in a while so it's possible it could have changed. You could try using verbose = True to see what parameters are being used in the tidygeocoder query and compare them with Google's API documentation.

I'll try it out when I get a chance.

@isaactpetersen
Copy link

I'm having the same issue. I tried verbose = TRUE but not flags, warnings, or errors come up. It says HTTP Status Code: 200.

@jessecambon
Copy link
Owner

I'm having the same issue. I tried verbose = TRUE but not flags, warnings, or errors come up. It says HTTP Status Code: 200.

Can you post the full output from the terminal? (All the messages etc.)

@isaactpetersen
Copy link

Here is a reproducible example (using a different address than the residential addresses I'm working with):

> example <- data.frame(
+     street = "303 Peachtree St NE",
+     city = "Atlanta",
+     state = "GA",
+     zip = "30308",
+     address = "303 Peachtree St NE, Atlanta, GA 30308"
+ )
> 
> example %>%
+     geocode(
+         address = address,
+         method = "google",
+         full_results = TRUE,
+         api_options = list(census_return_type = "geographies"),
+         verbose = TRUE)

Number of Unique Addresses: 1
Passing 1 address to the Google single address geocoder
[---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 0/1 (  0%) Elapsed:  0s Remaining:  ?s
Number of Unique Addresses: 1
Querying API URL: https://maps.googleapis.com/maps/api/geocode/json
Passing the following parameters to the API:
address : "303 Peachtree St NE, Atlanta, GA 30308"
key : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
HTTP Status Code: 200
Query completed in: 0.1 seconds

[=======================================================================================================================================================================================] 1/1 (100%) Elapsed:  0s Remaining:  0s
# A tibble: 1 × 7
  street              city    state zip   address                                  lat  long
  <chr>               <chr>   <chr> <chr> <chr>                                  <dbl> <dbl>
1 303 Peachtree St NE Atlanta GA    30308 303 Peachtree St NE, Atlanta, GA 30308    NA    NA

@jessecambon
Copy link
Owner

@carlosyanez @isaactpetersen - I just tested both of your queries and I'm getting results. Perhaps there was a temporary issue with the Google geocoding service?

library(tidygeocoder)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
tibble(addr="Av. España 1680, Valparaíso, Chile") |>
  geocode(address = addr, method="google",
          full_results=TRUE)
#> Passing 1 address to the Google single address geocoder
#> Query completed in: 0.3 seconds
#> # A tibble: 1 × 19
#>   addr          lat  long address_components formatted_address navigation_points
#>   <chr>       <dbl> <dbl> <list>             <chr>             <list>           
#> 1 Av. España… -33.0 -71.6 <df [8 × 3]>       Av. España 1680,… <df [1 × 1]>     
#> # ℹ 13 more variables: place_id <chr>, types <list>,
#> #   geometry.location_type <chr>, geometry.bounds.northeast.lat <dbl>,
#> #   geometry.bounds.northeast.lng <dbl>, geometry.bounds.southwest.lat <dbl>,
#> #   geometry.bounds.southwest.lng <dbl>, geometry.location.lat <dbl>,
#> #   geometry.location.lng <dbl>, geometry.viewport.northeast.lat <dbl>,
#> #   geometry.viewport.northeast.lng <dbl>,
#> #   geometry.viewport.southwest.lat <dbl>, …

Created on 2025-02-18 with reprex v2.1.1

library(tidygeocoder)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

example <- data.frame(
       street = "303 Peachtree St NE",
       city = "Atlanta",
      state = "GA",
      zip = "30308",
      address = "303 Peachtree St NE, Atlanta, GA 30308"
   )


 example %>%
     geocode(
             address = address,
             method = "google",
            full_results = TRUE,
             api_options = list(census_return_type = "geographies"),
            verbose = TRUE)
#> 
#> Number of Unique Addresses: 1
#> Passing 1 address to the Google single address geocoder
#> 
#> Number of Unique Addresses: 1
#> Querying API URL: https://maps.googleapis.com/maps/api/geocode/json
#> Passing the following parameters to the API:
#> address : "303 Peachtree St NE, Atlanta, GA 30308"
#> key : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
#> HTTP Status Code: 200
#> Query completed in: 0.2 seconds
#> 
#> Query completed in: 0.2 seconds
#> # A tibble: 1 × 19
#>   street              city    state zip   address   lat  long address_components
#>   <chr>               <chr>   <chr> <chr> <chr>   <dbl> <dbl> <list>            
#> 1 303 Peachtree St NE Atlanta GA    30308 303 Pe…  33.8 -84.4 <df [8 × 3]>      
#> # ℹ 11 more variables: formatted_address <chr>, navigation_points <list>,
#> #   place_id <chr>, types <list>, geometry.location_type <chr>,
#> #   geometry.location.lat <dbl>, geometry.location.lng <dbl>,
#> #   geometry.viewport.northeast.lat <dbl>,
#> #   geometry.viewport.northeast.lng <dbl>,
#> #   geometry.viewport.southwest.lat <dbl>,
#> #   geometry.viewport.southwest.lng <dbl>

Created on 2025-02-18 with reprex v2.1.1

@isaactpetersen
Copy link

isaactpetersen commented Feb 22, 2025

Hmm, it's still not working for me for some reason--even though it used to. I'm not aware with any issues/changes with my API key. Here's my reprex:

library("tidygeocoder")

Sys.setenv(GOOGLEGEOCODE_API_KEY = "[BLINDED]")

example <- data.frame(
  street = "303 Peachtree St NE",
  city = "Atlanta",
  state = "GA",
  zip = "30308",
  address = "303 Peachtree St NE, Atlanta, GA 30308")

example |>
  geocode(
    address = address,
    method = "google",
    full_results = TRUE,
    api_options = list(census_return_type = "geographies"),
    verbose = TRUE)
#> 
#> Number of Unique Addresses: 1
#> Passing 1 address to the Google single address geocoder
#> 
#> Number of Unique Addresses: 1
#> Querying API URL: https://maps.googleapis.com/maps/api/geocode/json
#> Passing the following parameters to the API:
#> address : "303 Peachtree St NE, Atlanta, GA 30308"
#> key : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
#> HTTP Status Code: 200
#> Query completed in: 0.2 seconds
#> 
#> Query completed in: 0.2 seconds
#> # A tibble: 1 × 7
#>   street              city    state zip   address                      lat  long
#>   <chr>               <chr>   <chr> <chr> <chr>                      <dbl> <dbl>
#> 1 303 Peachtree St NE Atlanta GA    30308 303 Peachtree St NE, Atla…    NA    NA

sessionInfo()
#> R version 4.4.2 (2024-10-31 ucrt)
#> Platform: x86_64-w64-mingw32/x64
#> Running under: Windows 10 x64 (build 19045)
#> 
#> Matrix products: default
#> 
#> 
#> locale:
#> [1] LC_COLLATE=English_United States.utf8 
#> [2] LC_CTYPE=English_United States.utf8   
#> [3] LC_MONETARY=English_United States.utf8
#> [4] LC_NUMERIC=C                          
#> [5] LC_TIME=English_United States.utf8    
#> 
#> time zone: America/Chicago
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] tidygeocoder_1.0.5
#> 
#> loaded via a namespace (and not attached):
#>  [1] vctrs_0.6.5       httr_1.4.7        cli_3.6.4         knitr_1.49       
#>  [5] rlang_1.1.5       xfun_0.51         generics_0.1.3    jsonlite_1.9.0   
#>  [9] glue_1.8.0        htmltools_0.5.8.1 rmarkdown_2.29    evaluate_1.0.3   
#> [13] tibble_3.2.1      fastmap_1.2.0     yaml_2.3.10       lifecycle_1.0.4  
#> [17] compiler_4.4.2    dplyr_1.1.4       fs_1.6.5          pkgconfig_2.0.3  
#> [21] rstudioapi_0.17.1 digest_0.6.37     R6_2.6.1          utf8_1.2.4       
#> [25] reprex_2.1.1      tidyselect_1.2.1  pillar_1.10.1     curl_6.2.1       
#> [29] magrittr_2.0.3    tools_4.4.2       withr_3.0.2

Created on 2025-02-22 with reprex v2.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants