How to display polygon title while using google map api -


i have drawn polygon each state on united states map. wish display value (text/int) on top of it. couldnt find polygon options able display text on top of polygon. ways this?

var poly = new google.maps.polygon({                             clickable: true,                             paths: pts,                             strokecolor: '#000000',                             strokeopacity: 0.3,                             strokeweight: 1,                             fillcolor: colour,                             fillopacity: 0.8,                             title: name                         });                         polys.push(poly);                         poly.setmap(map); 

you can maplabel utility. set location of label , apply options through object.

label: new maplabel({     text: result[index].name,     position:         new google.maps.latlng(object.lat, object.lng), // lat/lng of location of label.     fontsize: 10,     fontcolor: #000,     labelinbackground: true,     strokecolor: #000,     map: map   // map object place label on }) 

Comments