I had request from one client to create Google Map on one website, with database of almost 200 000 locations. Depending on filter criteria, it should be possible to show up to 800 locations on the map(this limitation is due to Google API). Locations haven’t contained geo codes(coordinates).
It would be possible to use Google API using address, but their geo coding service is so fast, and imagine how that would work for 800 locations. So, we decided first to convert addresses into geo codes. This can be easily done by google geocoding service, which was done as batch process. We had to run this service few days, because large number of locations and Google request limitation.
Once this is done, next step was to show those locations on map. For this we used Google Map API for PHP developed by Monte Ohrt (Google Map API for PHP). Their library contain one file-class, with very good examples/documentation, so we were able to integrate into our website very fast. It was also easy to integrate with smarty templates we used.
So, the reason why we avoided direct coding in javascript, is mainly because smarty code would become unreadable with few loops, few condition checking, which look much more natural if done in PHP.