Below is an example of 3 polygons I'm adding to a map. I intend to include click events to each; however, I would like to output some element of each polygon that I can refer to and relate to other data such as description, images, etc. The output could be the short title (variable names) given to each shape- here e609, c815, and c840- or an index number- ideally the number given in the comment before each polygon.
Are polygons given index numbers given on the order they enter the map? If so, how do I refer to this number as to pass it to another function? Alternatively, how could I pass along the short titles?
//0
var e609;
var e609_c = [
//Latlng, cut for space.
];
e609 = new google.maps.Polygon({
paths: e609_c,
strokeOpacity: 0,
fillColor: "#B1509E",
fillOpacity: .4
});
e609.setMap(map);
//1
var c815;
var c815_c = [
//Latlng, cut for space.
];
c815 = new google.maps.Polygon({
paths: c815_c,
strokeOpacity: 0,
fillColor: "#B1509E",
fillOpacity: .4
});
c815.setMap(map);
//2
var c840;
var c840_c = [
//Latlng, cut for space.
];
c840 = new google.maps.Polygon({
paths: c840_c,
strokeOpacity: 0,
fillColor: "#B1509E",
fillOpacity: .4
});
c840.setMap(map);