Как открыть различную информацию для каждого созданного мною полигона? Google maps api v3
Вот код, который яm в данный момент работает: пользователь может создать свой собственный полигон после того, как его полигоны показаны на карте. Я хочу отобразить некоторую информацию о каждом полигоне. Я'Я сейчас открываю информационное окно, но я могуполучить информацию для разных полигонов
Какие-нибудь мысли?
result() as $f):?>
// Create an array with the coordanates of each area
var areaid?>Coords = [
resources_data->field_latlng($f->id);?>
result() as $point):?>
new google.maps.LatLng(lat?>, lng?>),
];
// Create a polygon with the points of the area
var areaid?>=new google.maps.Polygon({
paths: areaid?>Coords,
strokeColor: '#FF0000',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#FF0000',
fillOpacity: 0.35
});
// Add the Field to the map.
areaid?>.setMap(map);
google.maps.event.addListener(fieldid?>,'click',function(event){
infowindow.setContent(contentString);
if (event) {
point = event.latLng;
}
infowindow.setPosition(point);
infowindow.open(map);
});
google.maps.event.addListener(map, 'click', function() {
infowindow.close();
});
var contentString = ''+
''+
''+
'name?> '+
''+
'' +
' '+
''+
' '+
' '+
'';
var infowindow = new google.maps.InfoWindow({
content: contentString
});