i trying create map using custom marker icons of various shapes , colors. have code working such can use single marker locations, not different markers different locations. programming filemaker pro solution i'm writing code in javascript. new javascript , i'm picking things go, below code have far:
var concus = 'dropbox/filemaker pro files/filemaker pro contract bid files/images/red_customer.png'; var rencus = 'dropbox/filemaker pro files/filemaker pro contract bid files/images/purple_customer.png'; var sercus = 'dropbox/filemaker pro files/filemaker pro contract bid files/images/green_customer.png'; var connon = 'dropbox/filemaker pro files/filemaker pro contract bid files/images/red_noncustomer.png'; var rennon = 'dropbox/filemaker pro files/filemaker pro contract bid files/images/purple_noncustomer.png'; var sernon = 'dropbox/filemaker pro files/filemaker pro contract bid files/images/green_noncustomer.png'; var imagenum; var markers = []; (var = 0; < data.length; ++i) { var latlng = new google.maps.latlng(data[i].latitude, data[i].longitude); var marker = new google.maps.marker({position: latlng, map: map, icon: markerimage[i], title:data[i].label, info:data[i].info}); markers.push(marker); }
"markerimage" after "icon: " array stores values "concus, rencus, sercus...etc" database. if replace "markerimage" of specific ones script works , shows me map locations on them. if use markerimage map nothing on it.
any appreciated!
zak
try this:
var iconbase = 'dropbox/filemaker pro files/filemaker pro contract bid files/images/'; var icons = { concus: { icon: iconbase + 'red_customer.png' }, rencus: { icon: iconbase + 'purple_customer.png' }, sercus: { icon: iconbase + 'green_customer.png' }, connon: { icon: iconbase + 'red_noncustomer.png' }, rennon: { icon: iconbase + 'purple_noncustomer.png' }, sernon: { icon: iconbase + 'green_noncustomer.png' } }; function addmarker(feature) { var marker = new google.maps.marker({ position: feature.position, icon: icons[feature.type].icon, map: map }); }
Comments
Post a Comment