我正在使用谷歌地图API V2,我有像形状的geozones。现在想要在单位(简单标记)进入形状协调时获得警报。我怎么能这样做?
答案 0 :(得分:1)
<script type ="text/javascript">
$(document).ready(function () {
function changeMarker(marker) {
marker.setIcon("images/bluemarker.png");
}
var map;
var infowindow;
var info1;
var triangleCoords = [];
function InitializeMap() {
var myOptions =
{
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map"), myOptions);
triangleCoords = [
new google.maps.LatLng(20.874252, -80.190262),
new google.maps.LatLng(18.466465, -66.118292),
new google.maps.LatLng(32.321384, -64.75737),
new google.maps.LatLng(20.874252, -80.190262)
];
// Construct the polygon
// Note that we don't specify an array or arrays, but instead just
// a simple array of LatLngs in the paths property
Triangle = new google.maps.Polygon({
paths: triangleCoords,
strokeColor: "#FF0000",
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: "#FF0000",
fillOpacity: 0.35
});
Triangle.setMap(map);
}
function markicons() {
InitializeMap();
var ltlng = [];
var markers = [];
ltlng.push(new google.maps.LatLng(22.76, -79.28));
ltlng.push(new google.maps.LatLng(18.76, 83.30));
map.setCenter(triangleCoords[0]);
for (var i = 0; i < ltlng.length; i++) {
marker = new google.maps.Marker({
map: map,
position: ltlng[i],
draggable: true,
//icon: "images/greymarker.png",
animation: google.maps.Animation.DROP,
title: "this is " + i + "marker"
});
}
}
window.onload = markicons;
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server" >
<h2>Multiple Markers :</h2>
<div id="map-container"><div id="map"></div></div>
</asp:Content>
您的问题分为两部分
希望这会有所帮助:D