Creating a google map visualization. Currently i am using an API to pull down colored markers using a URL from google; the base url is http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|
From here you can attach a color code to this URL like so; http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|008000
I would like to store these in some type of javascript variable so that I only have to call this URL 1 time instead of 100 times for each marker.
Current code which does not work.
var highPin = http: //chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|008000;
var lowPin = http: //chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|FFFF00;
var medPin = http: //chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|FE7569;
balloons[1] = {
center: new google.maps.LatLng(67.1679, 18.3974),
id: 1,
pin: highPin,
addr: '00602',
txt: 'stuff'
};
var bInfo = new google.maps.InfoWindow();
for (i in balloons) {
var balloonOptions = {
map: map,
id: balloons[i].id,
position: balloons[i].center,
icon: balloons[i].pin,
infoWindowIndex: i
};
bMarker = new google.maps.Marker(balloonOptions);
google.maps.event.addListener(bMarker, 'click', (function (bMarker, i) {
return function () {
if (bInfo) {
infoWindow.close();
tInfo.close();
bInfo.close();
}
bInfo.setContent(balloons[i].txt);
bInfo.setPosition(balloons[i].center);
bInfo.open(map);
}
})(bMarker, i));
}
This seems to kind of resolve the issue.
var highPin = 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|008000';
var lowPin = 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|FFFF00';
var medPin = 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|FE7569';
But I think the URL is still called for each pin. Is there a way I can perform this action and only have to call the URL 1 time?