开发者

What is the best way to plot points on a Google map?

What is the best way to plot points on a Google map? I have a bunch of addresses (about 300) stored in my database, and right now I am outputting each address into a JS array and plotting each addr开发者_开发问答ess by looping over the array and running a function that geocodes the address and creates a new marker. However, I'm not sure if that is the best approach. Any thoughts?


Your problem is the geocoding part. Geocoding 300 addresses in one go is slow, and you would quickly hit the daily limit.

You should consider doing the geocoding on the server-side, and caching them in your database, or somewhere else. The Google Maps API Terms of Use appear to permit the caching of geocoding results "for the purpose of improving the performance of your Maps API Implementation" (Section 10.3).


If the addresses are relatively constant, then the repeated geocoding isn't terribly efficient. You could geocode each once and submit to Google Maps only the latitude and longitude for plotting. See the KML upload information.


What I ended up doing was geocoding the addresses upon address insertion into my databas using a web service called Tiny Geocoder: http://tinygeocoder.com/.

For the existing addresses I already had, I ran a script that used this same service to loop over my result set, geocode each address, and store the lat/long in the database. It took awhile but it got the job done.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜