jessecambon / tidygeocoder

Geocoding Made Easy

Home Page:https://jessecambon.github.io/tidygeocoder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add TomTom support

dieghernan opened this issue · comments

Following #62 , I have implemented TomTom:

See the checklist below:

Data

  • data-raw/api_reference.R updated
  • Modify R/data.R

Sandbox

  • Added sandbox/query_debugging/tomtom_test.R
  • Added sandbox/reverse_queries/tomtom_reverse.R
  • Sandbox for TomTom batch added
  • Sandbox for TomTom batch reverse added

Code

  • R/utils.R - Utils added for TomTom
  • R/query_factory.R updated
  • R/geo_methods.R updated
  • R/geo.R updated
  • R/reverse_geo.R updated

Batch

  • R/batch_geocoding.R updated
  • R/reverse_batch_geocoding.R updated

Testing

Misc

  • Update README
  • Fix on R/reverse_geo.R to avoid errors on no_query = TRUE

I am polishing the PR with a final huge batch geocoding test, but overall my experience on this is that TomTom runs smoothly and fast, I think it could be a great addition to the package

@dieghernan I pulled this into master. 👍 Note that I changed the query_api function to return a named list so that we can see the HTTP response status code. I also adjusted the logic in geo(), reverse_geo(), and related tests to use the HTTP status code when checking if a query was successful.

Agree, the json parsing inside query_api was a bit troublesome, I think it is better now

@dieghernan I changed the extract_errors_from_results() function in utils.R so that it will just display the raw content if it is not valid JSON:

extract_errors_from_results <- function(method, response, verbose) {

That worked for me with TomTom when I passed an invalid api key, but let me know if you spot any issues. That function will only be called if the HTTP response status != 200.

Thanks!! I’ll check and would let you know