No, there is not really any other way : if you have many locations and want to display them on a map, the best solution is to :
- fetch the latitude+longitude, using the geocoder, when a location is created
- store those in your database, alongside the address
- and use those stored latitude+longitude when you want to display the map.
This is, of course, considering that you have a lot less creation/modification of locations than you have consultations of locations.
Yes, it means you’ll have to do a bit more work when saving the locations — but it also means :
- You’ll be able to search by geographical coordinates
- i.e. “I want a list of points that are near where I’m now“
- Displaying the map will be a lot faster
- Even with more than 20 locations on it
- Oh, and, also (last but not least) : this will work 😉
- You will less likely hit the limit of X geocoder calls in N seconds.
- And you will less likely hit the limit of Y geocoder calls per day.