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

batch geocoding using here api #194

Open
ashishchalise5 opened this issue Aug 23, 2023 · 2 comments
Open

batch geocoding using here api #194

ashishchalise5 opened this issue Aug 23, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@ashishchalise5
Copy link

Description

I am using the same dataset for both single geocoding and batch geocoding however the single geocoding works fine batch encoding doesnot give any lat long values

Steps to Reproduce

Include a small code example that someone else can run to reproduce the bug:

vendors<- read_csv("https://drive.google.com/uc?export=download&id=13oEQvP2sYwjNTKBVLat8mbp881mvpNkr")
location2<- tidygeocoder::geo(vendors$`Full Address`,method="here",mode="batch")
View(location2)

Result:
Passing 289 addresses to the HERE batch geocoder
Error:
Query completed in: 1.8 seconds

@ashishchalise5 ashishchalise5 added the bug Something isn't working label Aug 23, 2023
@jessecambon
Copy link
Owner

jessecambon commented Sep 2, 2023

This appears to be a problem caused by the "#" character in the third address:

> vendors$`Full Address`[3]
[1] "Unit#6 - 421 Sandwich Street South Amherstburg, Ontario N9V 3K8"

Here's the error I get:

> vendors$`Full Address`[1:3] |> tidygeocoder::geo(method="here",mode="batch")
Passing 3 addresses to the HERE batch geocoder
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  : 
  line 3 did not have 6 elements

When I remove the # character it works:

> vendors$`Full Address`[1:3] |> stringr::str_replace_all("#", " ") |> tidygeocoder::geo(method="here",mode="batch")
Passing 3 addresses to the HERE batch geocoder
Query completed in: 28.8 seconds
# A tibble: 3 × 3
  address                                                           lat  long
  <chr>                                                           <dbl> <dbl>
1 15 Westney Rd N Ajax, Ontario L1T 1P5                            43.9 -79.0
2 50 King St S Alliston, Ontario L9R 1H6                           44.1 -79.9
3 Unit 6 - 421 Sandwich Street South Amherstburg, Ontario N9V 3K8  42.1 -83.1

For the next release we can look at trying to escape these characters within tidygeocoder, but for now you can remove the character manually like I did above. Issue #190 is also related to escaping characters.

@dieghernan

@baarthur
Copy link

baarthur commented Jan 17, 2024

Hey, I am having a similar issue; however, I already tidied my address to remove any special characters. Here's a reprex —also, I included a tilde, however it makes no difference if I remove it:

library(dplyr)

library(sf)
library(tidygeocoder)

df <- tibble::tibble(
  street_name = c("rua são paulo", "av prof alfredo balena", "av getulio vargas"),
  street_number = c(656, 400, 1300),
  postcode = c(30170130, 30130100, 30112021)
)

# this works
df <- df %>% 
  mutate(query = paste0(street_name, ", ", street_number, " - ", postcode)) %>% 
  geocode(address = query, method = "here")

# this doesn't 
df <- df %>% 
  mutate(query = paste0(street_name, ", ", street_number, " - ", postcode)) %>% 
  geocode(address = query, method = "here", mode = "batch")

As happened to @ashishchalise5, it's just an empty error message, so I have no clue about what's happening.

Btw, i found that method = "here" is very smooth compared to others. I was using arcgis, and now I'm using here to geocode the addresses arcgis couldn't find, and there's a high rate of success; however, it would be better if I could batch them!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants