I'm using Google Maps API v3. My code takes objects (name, lat, lng, and type) from MySql database and markers their on map. That works for me fine. But I want to make different markers depending on them type. So here is my markers options:
var iconBaznycios = new google.maps.MarkerImage('http://labs.google.com/ridefinder/images/mm_20_blue.png');
var iconMuziejai = new google.maps.MarkerImage('http://labs.google.com/ridefinder/images/mm_20_red.png');
var customIcons = [];
customIcons["Baznycios"] = iconBaznycios;
customIcons["Muziejai"] = iconMuziejai;
And here is my function i want to pass my markers array:
function addMarker(lat, lng, info, type) {
var pt = new google.maps.LatLng(lat, lng);
bounds.extend(pt);
var marker = new google.maps.Marker({
position: pt,
icon: customIcons[type],
map: map,
});
and maybe there is something to do with this line in php script:
echo ("addMarker($lat, $lng,'<b>$name</b><br/> $type');\n");
any ideas how to make it work my way?