pythonaro.com

Pythonaro blog

21 August 2008

Note to self

If you ever have to implement a service that needs the user location, don't rely on the address (messy, error-prone due to misspelling, nonstandard across countries...). Just use a GoogleMap widget and then store the coordinates, plus a free-form text field if you really need the address (e.g. for mailing etc).

This system will scale effortlessly and it will be much simpler to implement lookups like "people near you in a 5-miles radius". You might want to store the country in a separate field for i18n purposes, but even with that, you will have 3 fields (coordinates, free-form address, country) vs umpteen (house/flat number, block name, two or three lines which might not even be enough for some users, town, city, district, postcode with format differing by country etc etc...) which are very hard to use in a geo-aware way.

(This presumes that you are starting from scratch; if you have to bidirectionally interface with legacy systems, chances are that you'll need to stick with the bad ol' stuff).

Labels: ,

posted by GiacomoL @ 8:35 AM   2 comments links to this post