jessecambon / tidygeocoder

Geocoding Made Easy

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

single address geocoding mismatch with bing and limit > 1

jessecambon opened this issue · comments

This query returns 20 rows (10 per each address), however the lat and long columns are constant for each address. There seems to be an issue with extracting multiple latitude and longitude values with the bing service.

a <- geocode(tibble(x = c('paris', 'london')), address = x, full_results = TRUE, method = 'bing', limit = 10, return_input = FALSE, return_addresses = FALSE, verbose = TRUE, mode = 'single')

image

On looking into this more I think I created this problem with some changes I made to the extract_results() function. Reverting to this code in extract_results() seems to fix this issue:

 lat_lng <- switch(method,
....
      'bing' = as.data.frame(matrix(unlist(response$resourceSets$resources[[1]]$point$coordinates), 
            ncol = 2, byrow = TRUE), col.names = c('lat', 'long'))
  )