Add TomTom support
dieghernan opened this issue · comments
Following #62 , I have implemented TomTom:
- Docs:
- Geocode: https://developer.tomtom.com/search-api/search-api-documentation-geocoding/geocode
- Reverse Geocode: https://developer.tomtom.com/search-api/search-api-documentation-reverse-geocoding/reverse-geocode
- Batch: https://developer.tomtom.com/search-api/search-api-documentation-batch-search/asynchronous-batch-submission
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
-
testthat
test added - Modify
regression_testing.Rmd
- Run tests included in https://github.com/jessecambon/tidygeocoder/blob/master/cran-comments.md
Misc
- Update README
- Fix on
R/reverse_geo.R
to avoid errors onno_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
@jessecambon I think the error handling of TomTom is not incorporated after the last PR:
@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:
Line 155 in 739853f
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