Naming polygons on google maps

2

I'm using a google maps api to generate some fields and I'd like to generate their names in the polygon itself as soon as I open the map instead of generating it in the balloon.

codethatgeneratesthepolignos:

varmap;varinfoWindow;functioninitMap(){map=newgoogle.maps.Map(document.getElementById('map'),{zoom:15,center:{lat:-15.968679,lng:-54.965524},mapTypeId:google.maps.MapTypeId.TERRAIN});//DefinetheLatLngcoordinatesforthepolygon.vartriangleCoords1=[{lat:-15.968679,lng:-54.965524},{lat:-15.968589,lng:-54.965446},{lat:-15.968447,lng:-54.965387},{lat:-15.968254,lng:-54.965410},{lat:-15.968099,lng:-54.965520},{lat:-15.968019,lng:-54.965673},{lat:-15.968029,lng:-54.965917},{lat:-15.968111,lng:-54.966056},{lat:-15.968237,lng:-54.966139},{lat:-15.968454,lng:-54.966174},{lat:-15.968647,lng:-54.966080},{lat:-15.968793,lng:-54.965872},{lat:-15.968759,lng:-54.965633},{lat:-15.968679,lng:-54.965524}];//Constructthepolygon.varbermudaTriangle1=newgoogle.maps.Polygon({paths:triangleCoords1,strokeColor:'#0000FF',strokeOpacity:0.8,strokeWeight:3,fillColor:'#0000FF',fillOpacity:0.35});bermudaTriangle1.setMap(map);

Itriedtousethisbutitdidnotworkeither.

font="20px Georgia";
strokeText("Texto",10,50);

How would I do to print the names directly on the polygon without opening the balloon?

    
asked by anonymous 04.08.2016 / 15:18

0 answers