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 Bing support #92

Closed
dieghernan opened this issue Mar 23, 2021 · 3 comments · Fixed by #93
Closed

Add Bing support #92

dieghernan opened this issue Mar 23, 2021 · 3 comments · Fixed by #93

Comments

@dieghernan
Copy link
Contributor

Following #62 , I have implemented Bing:

Docs:

About Bing batch geocoding service

It is very similar to Batch Geocoding on HERE (see #74), in the sense that it is a POST/wait/GET process with a maximum limit of 50 addresses and really slow, so the user must force batch geocoding with geo(method="bing", mode="batch")-

Regards

@jessecambon
Copy link
Owner

@dieghernan

I pulled in your PR on the bing branch. Batch geocoding is working for me, but I'm getting NA results with single geocoding:

library(tidygeocoder)
geo(sample_addresses$addr[1:3], method = 'bing', full_results = TRUE, verbose = TRUE)
#> Number of Unique Addresses: 3
#> Executing single address geocoding...
#> Number of Unique Addresses: 1
#> Querying API URL: http://dev.virtualearth.net/REST/v1/Locations
#> Passing the following parameters to the API:
#> q : "1600 Pennsylvania Ave NW Washington, DC"
#> key : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
#> maxResults : "1"
#> 
#> HTTP Status Code: 200
#> Query completed in: 0.6 seconds
#> 
#> Number of Unique Addresses: 1
#> Querying API URL: http://dev.virtualearth.net/REST/v1/Locations
#> Passing the following parameters to the API:
#> q : "600 Montgomery St, San Francisco, CA 94111"
#> key : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
#> maxResults : "1"
#> 
#> HTTP Status Code: 200
#> Query completed in: 0.2 seconds
#> 
#> Number of Unique Addresses: 1
#> Querying API URL: http://dev.virtualearth.net/REST/v1/Locations
#> Passing the following parameters to the API:
#> q : "11 Wall Street, New York, New York"
#> key : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
#> maxResults : "1"
#> 
#> HTTP Status Code: 200
#> Query completed in: 0.2 seconds
#> 
#> # A tibble: 3 x 3
#>   address                                      lat  long
#>   <chr>                                      <dbl> <dbl>
#> 1 1600 Pennsylvania Ave NW Washington, DC       NA    NA
#> 2 600 Montgomery St, San Francisco, CA 94111    NA    NA
#> 3 11 Wall Street, New York, New York            NA    NA

Created on 2021-03-24 by the reprex package (v1.0.0)

The only code change I made was to allow the user to pass custom_query to the batch geocoder function.

@jessecambon
Copy link
Owner

Looks like the issue was just that extract_results() wasn't getting the format it expected for latitude and longitude. The commit above fixes this.

@dieghernan
Copy link
Contributor Author

Thanks! The extract_results() for Bing was a bit challenging, I have to say. I guess it broke after I merged main with the latest changes, good catch @jessecambon

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