var map; var array = [[41.774166667, 85.943055556], [43.864052, 87.560499]];//latitude and longitude var array1 = ["Location 1", "Location 2"]; var latitude = 0; var longitude = 0; var markersarray = []; var title = "Xinjiang"; var openinfo = ""; function Initialize () {var i = 0; var k = 0; var mylatlng = new Google.maps.LatLng (41.774166667, 85.943055556); Initial position var myoptions = {Zoom:8,//Map zoom level CENTER:MYLATLNG,//Map Center location mapTypeId:google.ma Ps. Maptypeid.roadmap,//constant roadmap with a map display constant satellite for satellite display DISABLEDOUBLECLICKZOOM:TRUE//disable double-click Zoom Map}; Bind the map to the DIV with id map_canvas map = new Google.maps.Map (document.getElementById ("Map_canvas"), myoptions); The loop populates the data into a new marker object for (i = 0; i < Array.Length; i++) {var mylatlng = new Google.maps.La TLNG (Array[i][k], array[i][k + 1]);//reposition//Display information openinfo = Array1[i]; Flag icon showing the address var marker = new Google.maps.Marker ({posiTION:MYLATLNG, Map:map, icon: ' http://www.yiyacn.com/uploads/tubiaoimg/icon/fatcow_02 7.png '//Custom Tag icon}); Marker.settitle (title); Alerttitle (marker, openinfo); }; Infowindow.open (map); Display prompt main window when loading var Infowindow; var infowindow2; Prompt Information window function alerttitle (marker, OpenInfo) {//hover on the tag to open the Prompt information window Google.maps.event.addLis Tener (marker, ' mouseover ', function (event) {infowindow2 = Infowindow; Infowindow = new Google.maps.InfoWindow ({content:openinfo, position:mylatlng }); if (infowindow2! = null) {infowindow2.close (); } infowindow.open (map, marker); }); The mouse left tag closes the prompt message window//google.maps.event.addlistener (marker, ' mouseout ', function (event) {//infowindow.close ( ); //}); }; Add double-click event Google.maps.event.addDomListener (Map, ' DblClick ', function (event) {Placemarker (event) to map. LATLNG); Creatediv (EVENT.LATLNG); }); Add a new Identity function Placemarker (location) {if (infowindow2! = null) {infowindow2.close (); } if (Infowindow! = null) {infowindow.close (); } marker = new Google.maps.Marker ({position:location, Map:map, Title:title, Icon: ' http://www.yiyacn.com/uploads/tubiaoimg/icon/fatcow_027.png '//Custom marker icon }); Clearoverlays (); Markersarray.push (marker); Add the Marker object to the Markersarray array map.setcenter (location); Reposition Center}//Create operation layer function Creatediv (location) {var array = location.tostring (). spli T (","); Latitude var contentstring = ' <div id= ' ContenT "> ' + ' <div id=" sitenotice "> ' + ' </div> ' + '
Google. Small examples of GIS