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

Add TomTom support #76

Closed
18 tasks done
dieghernan opened this issue Mar 11, 2021 · 5 comments · Fixed by #80
Closed
18 tasks done

Add TomTom support #76

dieghernan opened this issue Mar 11, 2021 · 5 comments · Fixed by #80

Comments

@dieghernan
Copy link
Contributor

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

This was referenced Mar 11, 2021
@jessecambon
Copy link
Owner

@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.

@dieghernan
Copy link
Contributor Author

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

@dieghernan
Copy link
Contributor Author

dieghernan commented Mar 13, 2021

@jessecambon I think the error handling of TomTom is not incorporated after the last PR:

https://github.com/dieghernan/tidygeocoder/blob/54ae775a8783006d6373450d73210e3547d8de66/R/utils.R#L196:L198

@jessecambon
Copy link
Owner

@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.

@dieghernan
Copy link
Contributor Author

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

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