var map = new Microsoft.Maps.Map(document.getElementById("mapDiv"), { credentials: "AlkUIczX_RUWzPNUFvZKvPibJQ6JRazm0A8GLA30WPMllJETWxw6ElDXZSe5ao84" }); //add pin to log,lat specified function setMapLocation(lat,longit) { // var location = new Microsoft.Maps.Location(48.03, -122.4); var location = new Microsoft.Maps.Location(lat, longit); var pushpin = new Microsoft.Maps.Pushpin(location); map.entities.push(pushpin); map.setView({ center: location, zoom: 10 }); } // Add pushpin to location and get lat and long function GetMap() { //Retrieve the location of the map center var center = map.getCenter(); //Add a pin to yhe center of the map var pin = new Microsoft.Maps.Pushpin(center, { draggable: true }); // Add a handler top the pushpin drag Microsoft.Maps.Events.addHandler(pin, 'mouseup', DisplayLoc); map.entities.push(pin); } //Get lat and long. of the pushpin function DisplayLoc(e) { if (e.targetType == 'pushpin') { var pinLoc = e.target.getLocation(); return pinLoc.latitude + ", " + pinLoc.longitude; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)