Hacker News new | ask | show | jobs
by AznHisoka 4530 days ago
Nice! Technical question:

I type "Elmhurst, NY" and it converted it to "Elmhurst, Queens, NY 11373, USA", how did you do that? I'm looking to do something similar!

3 comments

I use the Google Maps Javascript api for geolocation. It takes a string and returns an array of places that match. Each place object includes a formatted address which I put in the search bar in place of what was initially typed.
Most geocoding APIs (Google: https://developers.google.com/maps/documentation/geocoding/) will normalize an address and give you data back about it.
I'm not 100% certain but I think this is the code you are looking for https://github.com/jendewalt/yumhacker/blob/master/lib/geoco...