-
Notifications
You must be signed in to change notification settings - Fork 21
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
geocode with method census returns NA if match_indicator = "Tie" #87
Comments
@davidkreitmeir thanks, could you post a reproducible example (https://www.tidyverse.org/help/) ? Also, I think the top of your code might have gotten cut off. |
@jessecambon thanks a lot for getting back to me. And sorry that part of the code got cut off. I kept playing around a bit more with the addresses that were originally flagged as I attached an xlsx file (csv was somehow not allowed) with 100 addresses that were originally flagged as a Note: A general issue seems to be that the geocoding is instable. In one run it returned for the
Thanks a lot for your help! |
@davidkreitmeir thanks for that. Unfortunately, it appears this is just the behavior of the geocoder service. According to the API documentation, a "tie" indicates multiple results for an address. This article mentions that ties return NA results. I also manually did a batch query and the raw results just contain NAs. However, you can get results if you use |
@jessecambon thanks so much for going through the effort. Just to not misunderstand anything: no matter if manual or (sorry your code did not run through: always resulted in my R session being aborted so could not check the manual version) |
Try this: library(dplyr)
library(tidygeocoder)
# these addresses should produce ties in batch mode
tie_addresses <- tibble::tribble(
~res_street_address, ~res_city_desc, ~state_cd, ~zip_code,
"624 W DAVIS ST #1D", "BURLINGTON", "NC", 27215,
"201 E CENTER ST #268", "MEBANE", "NC", 27302,
"7833 WOLFE LN", "SNOW CAMP", "NC", 27349,
)
## Try using tidygeocoder batch --- NA return
tg_batch <- tie_addresses %>%
geocode(street = res_street_address,
city = res_city_desc,
state = state_cd,
postalcode = zip_code,
method = 'census',
full_results = TRUE,
return_type = 'geographies'
)
## Try using single address geocoding - lat longs returned succesfully
tg_single <- tie_addresses %>%
geocode(street = res_street_address,
city = res_city_desc,
state = state_cd,
postalcode = zip_code,
method = 'census',
mode = 'single',
full_results = TRUE,
return_type = 'geographies'
)
The first query uses Census batch geocoding and returns "tie" results with NA coordinates. The second query uses Separately, I'm working on a |
Also this script should work now. There was a typo that was causing an issue. Here's the raw results coming from the Census batch geocoder for those addresses:
|
@davidkreitmeir FYI I reached out to the Census geocoding team and received this response:
|
@jessecambon thanks so much for all your efforts! Which brings me to a related point: I was trying to look into how to most efficiently geocode a large number of addresses. From stopping the time for different options (with Thanks a lot again for all your help! |
@davidkreitmeir you're welcome. I agree, I think that returning the best result (or just one of the results) and indicating that there are multiple results available would be desirable. I'm not sure if the Census team is looking to make adjustments to their service, but I could suggest it. I haven't done a lot of testing with large Census batch queries, but you can find the code for the most recent testing I did here. Is the main issue you are running into the NA results with "Tie"? Or are you just looking for the most time efficient way to go? At least in theory, whether you get a "tie" result should be dependent on the address and not the size of the batch query you use. |
@jessecambon thanks for getting back to me on this. I'm currently interest merely in the most efficient way to geocode addresses (I plan to deal with the |
@davidkreitmeir I haven't tested parallel batches, but I'd be curious what you find out. You could also ask the Census for guidance: geo.geocoding.services@census.gov. I've found them to be pretty responsive. |
This is the current code that I am running.
The text was updated successfully, but these errors were encountered: