A coarse splitting geocoder in scala, based primarily on geonames data
I'm evaluating Twofishes for geo lookup. I am surprised at how Twofishes handles zip codes.
If I do a lookup on the string "Beverly Hills" I get a city result (woeType
== 7) showing Beverly Hills, CA. So far, so good.
If I do a lookup on the string "90210" I get a postal code result (woeType
== 11). Not unreasonable.
If I do a lookup on the string "Beverly Hills, CA 90210" I get the postal code result, not the city result! And what's worse, if I set maxInterpretations
to get multiple results, I still don't get the city result... I get postal code, county, state, and country results, but not city!
I want to be able to take the string "90210" and get back the city "Beverly Hills, CA". And I absolutely need for "Beverly Hills, CA" and "Beverly Hills, CA 90210" to return the same results... it's broken that specifying a city name more precisely causes Twofishes to be unable to identify the city!
I've tried taking the latitude/longitude data from the postal code record, and looking that up; I didn't get a city record. I've tried setting woeRestrict
to 7, and I just get no results.
I do understand that it is possible for a single zip code to span multiple cities. If I just lookup a zip code I would be okay with it returning multiple city results. If I lookup "City Name, State #####" I would expect it to only return the "City Name, State" result, but I would be okay with it returning all postal code results; I can always sift through them and decide for myself which one is the closest match.
Source: (StackOverflow)