GrassHopperPebbles.com Demos

JQuery Plugins

imGoogleMaps 0.9 - Multiple Addresses

In this example, I set up the imGoogleMaps plugin to display multiple addresses. I received an error when testing the plugin with more than 10 addresses. I found out that Geocode Requests are limited to about 15000 per IP address per day (about 1 every 5.76 seconds).

Because of the Geocode Request limitations, I created an additional option for the plugin: geocode_request_rate.
The default value for this option is 500 (0.5 secs). So the plugin will make a request once every second. If you have more than about 10 addresses, you should try a higher value. In the example below, I set the geocode_request_rate to 5000 (5 secs).

Setting the request rate to a higher value causes the imGoogleMaps plugin to appear inactive to the user, so I incorporated the imProgessBar plugin into imGoogleMaps.

To set this option, you must supply the progress bar container id , progress bar back class, and the progress bar class.

progress_bar: {container: 'imProgBarCntnr', bar_back_class: 'imBarBack', bar_class: 'imProgBar'},

I have also hidden the directions menu in this example by setting the option: show_directions_menu: false. This setting can only be made in manual mode. The directions, search, and button_class options for the plugin are not needed when the show_directions_menu is set to false.

I am loading the addresses ajaxally using the data_url option. I'm loading a json object in a php file:

$json = '[';
$json .= '{"address": "1213 U St NW Washington, DC 20009"},';
$json .= '{"address": "1100 Florida Ave NW Washington, DC 20009"},';
$json .= '{"address": "50 Massachusetts Ave NE Washington, DC 20002"},';
$json .= '{"address": "1652 K St NW Washington, DC 20006"},';
$json .= '{"address": "1801 Connecticut Avenue NW Washington, DC 20009"},';
$json .= '{"address": "1401 K St NW Washington, DC 20005"},';
$json .= '{"address": "675 15th St NW Washington, DC 20005"},';
$json .= '{"address": "6th St & Constitution Ave NW Washington, DC 20001"},';
$json .= '{"address": "701 9th St NW Washington, DC 20001"},';
$json .= '{"address": "633 D Street NW Washington, DC 20001"},';
$json .= '{"address": "1401 Pennsylvania Ave NW Washington, DC 20004"},';
$json .= '{"address": "1122 9th St NW Washington, DC 20001"},';
$json .= '{"address": "1226 36th St NW Washington, DC 20007"},';
$json .= '{"address": "1001 Pennsylvania Ave Washington, DC 20004"},';
$json .= '{"address": "1200 New Hampshire Ave NW Washington, DC 20036"}';
$json .= ']';
echo $json;
 

I can optionally load the json object from the address option of the plugin

Note: When using the data_url option, the data_type option must be set to json.

View the source code for this page to see how to set up the plugin. For documentation on the imGoogleMaps plugin, see my original post: JQuery Plugin: imGoogleMaps and the imGooglMaps - 0.9 post that discusses multiple addresses and street view options.

Tags

, , , , , , , , , , , ,