Tidygeocoder access blocked to fetch lat long

Hi , I am trying to run the below code in posit cloud, but getting an access blocked error:

library(dplyr, warn.conflicts = FALSE)
library(tidygeocoder)

# create a dataframe with addresses
some_addresses <- tibble::tribble(
~name,                  ~addr,
"White House",          "1600 Pennsylvania Ave NW, Washington, DC",
"Transamerica Pyramid", "600 Montgomery St, San Francisco, CA 94111",     
"Willis Tower",         "233 S Wacker Dr, Chicago, IL 60606"                                  
)

# geocode
lat_longs <- some_addresses %>%
  geocode(addr, method = 'osm', lat = latitude , long = longitude)

geocode the addresses
lat_longs <- some_addresses %>%

geocode(addr, method = 'osm', lat = latitude , long = longitude)
Passing 3 addresses to the Nominatim single address geocoder
[--------------------------------------------] 0/3 ( 0%) Elapsed: 0s Remaining: ?sError:

Access blocked

Access blocked

You have been blocke [==============>-----------------------------] 1/3 ( 33%) Elapsed: 1s Remaining: 2sError: Access blocked

Access blocked

You have been blocke [============================>---------------] 2/3 ( 67%) Elapsed: 3s Remaining: 2sError: Access blocked

Access blocked

You have been blocke [============================================] 3/3 (100%) Elapsed: 6s Remaining: 0s Warning messages: 1: In query_api(api_url, api_query_parameters, method = method) : Forbidden (HTTP 403). 2: In query_api(api_url, api_query_parameters, method = method) : Forbidden (HTTP 403). 3: In query_api(api_url, api_query_parameters, method = method) : Forbidden (HTTP 403).

You could be running into the rate limits of the free tier for the geocoding service used by tidygeocoder:

It looks like OSM is limited to 1 query per second.

Keep in mind that Posit Cloud doesn't prohibit outgoing API calls. However, the outgoing IP addresses used to communicate with external services are shared with all Posit Cloud users. So, if any other user on the platform is using OSM for geocoding, then it would impact your rate limiting.

1 Like

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.