Getting OVER QUERY LIMIT after one request with geocode

后端 未结 5 1537
情歌与酒
情歌与酒 2020-11-29 04:20

I\'m using the ggmap\'s geocode to find the latitude and longitude of different cities. It worked completely fine yesterday but I get an OVER QUERY LIMIT after only one requ

相关标签:
5条回答
  • 2020-11-29 04:49

    If you want to be sure of your quota you can obtain a Google Maps API key, then use it in my googleway package

    library(googleway)
    
    key <- "your_api_key"
    
    google_geocode(address = "Paris", key = key)
    
    # $results
    # address_components
    # 1   Paris, Paris, Île-de-France, France, Paris, Paris, Île-de-France, FR, locality, political, administrative_area_level_2, political, administrative_area_level_1, political, country, political
    # 2 Paris, Lamar County, Texas, United States, Paris, Lamar County, TX, US, locality, political, administrative_area_level_2, political, administrative_area_level_1, political, country, political
    # formatted_address geometry.bounds.northeast.lat geometry.bounds.northeast.lng geometry.bounds.southwest.lat
    # 1     Paris, France                      48.90214                      2.469921                      48.81557
    # 2    Paris, TX, USA                      33.73838                    -95.435455                      33.61185
    # geometry.bounds.southwest.lng geometry.location.lat geometry.location.lng geometry.location_type
    # 1                      2.225193              48.85661              2.352222            APPROXIMATE
    # 2                    -95.627928              33.66094            -95.555513            APPROXIMATE
    # geometry.viewport.northeast.lat geometry.viewport.northeast.lng geometry.viewport.southwest.lat geometry.viewport.southwest.lng
    # 1                        48.90214                        2.469921                        48.81557                        2.225193
    # 2                        33.73838                      -95.435455                        33.61185                      -95.627928
    # place_id               types
    # 1 ChIJD7fiBh9u5kcRYJSMaMOCCwQ locality, political
    # 2 ChIJmysnFgZYSoYRSfPTL2YJuck locality, political
    # 
    # $status
    # [1] "OK"
    
    0 讨论(0)
  • 2020-11-29 04:51

    Tried to register for api_key, looks like a paid service.

    source = “dsk” seems to be the only workaround:

    geocode("Paris", source = "dsk")

    See if it works for you.

    0 讨论(0)
  • 2020-11-29 04:52

    The request doesn't use a key, which means: you share the quota with all pages hosted on the same server(same IP-address/may be houndreds of domains).

    As it seems this library only supports an option for business-users to provide credentials.

    There is a feature-request from 2014 , but as long as it's not implemented I'm afraid there is nothing you can do(as a non-business-user) when you use this library(except you modify the library, but I'm not familiar with R so I can't give further help).

    0 讨论(0)
  • 2020-11-29 05:04

    From June 11th 2018 Google changed the access to the Google API.

    Now you NEED to set a credit card to your account to get permission to use the APIs. There it's a free account which will not charge you nothing on your credit card with some limitations on the number of queries you can do (like we had before this change).

    If you need more queries you should change your account to a normal one which will charge you when you use the APIs more of the free limits.

    0 讨论(0)
  • 2020-11-29 05:16

    I had a similar problem using ggmap::geocode() for a batch of locations where roughly 20% of locations gave the OVER QUERY LIMIT error even though geocodeQueryCheck() would show more than enough geocoding queries remaining, and the errors were sporadically spread throughout the locations, not just the last 20%. If I reran the subset of locations that failed the first time, again most would work, so I had to iterate through smaller subsets until they all had geocodes.

    ggmap v2.7 allows the user to specify a Google Maps API key through the register_google() function. v2.7 is not on CRAN yet, so you have to use devtools::install_github("dkahle/ggmap") to install it. After updating to that version and setting my API Key register_google(key = "my_api_key"), the same batch worked in one run as expected.

    The Google Maps API Key is easy to get: https://developers.google.com/maps/documentation/geocoding/get-api-key

    0 讨论(0)
提交回复
热议问题