I am hoping to format international addresses that I get from geocoder.getLocations() in a simpler way, e.g., stripping out US zip codes. I would like to come up with a simple algorithm for using the AddressDetails to make my own simpler (and visually more pleasant) addresses.
I'm having trouble finding other people talking about this—is anyone doing this or is it too error prone? -- If you're interested in the details… the approach I'm considering for international addresses is: LocalityName, [AdministrativeAreaName, ] CountryName For example, I could change: New York, NY 10001, USA -> New York, NY, USA Manhattan, NY 10001, USA -> Manhattan, NY, USA Tramore, Co. Waterford, Ireland -> Tramore, Ireland Toronto, ON, Canada -> Toronto, ON, Canada Some notes about this technique: * This is seems to handle most cases, and I'm fine with the case of "New York, NY", "Manhattan, NY", and "Brooklyn, NY" all being different. * Apparently some locations don't use commas, like "Dubai - United Arab Emirates", I could either special case those or just use the commas * There could be collisions with these addresses… if you search for "Butler Township", you get two cases of "Butler, PA, USA" - but then again the google api doesn't show different addresses for them either (but it does properly do different lat/lng points) * If there is no LocalityName, maybe just use the address that the api returned - and if I don't want street names, I can use the technique I described here to try to strip ThoroughfareNames: http://groups.google.com/group/google-maps-api/browse_thread/thread/73ed1f8bd3393662 I'm aware that the xAL spec states: Address formatting is country specific and is outside the scope of the standards work. Rules on such formatting cannot be derived from the data or the data structure. It is therefore, up to the application to decide how and in which order the contents of xAL should be combined to form a legal address. But maybe this could work fine for 99.99% of cases and I can fall back on the regular address for the rest of the cases?
-- You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
