Reputation: 21
I have this google map line of code that I need to find the equivalent in Bing map
sb.Append("map.addOverlay(createMarker(new GLatLng(" + dataRow[7].ToString() + "," + dataRow[8].ToString() + "),");
I guess the new GLatLng takes these two values of (datarow 7 and datarow 8) and convert them to xy values as seen below:
Ba: -78.624148
x: -78.624148
Xd: 35.727867
y: 35.727867
How do I take two two values and convert them to XY values in use them with Bing Pushpin since I can't use GLatLng withg Bing.
Note: I am converting our map from google to Bing.
Upvotes: 2
Views: 144
Reputation: 18003
Bing Maps uses Microsoft.Maps.Location to represent a coordinate. Here is a simple example of how to add a pushpin:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Add default pushpin</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
<script type="text/javascript">
var map = null;
function getMap()
{
map = new Microsoft.Maps.Map(document.getElementById('myMap'), {credentials: 'Your Bing Maps Key'});
}
function addDefaultPushpin()
{
var pushpin= new Microsoft.Maps.Pushpin(map.getCenter(), null);
map.entities.push(pushpin);
}
</script>
</head>
<body onload="getMap();">
<div id='myMap' style="position:relative; width:400px; height:400px;"></div>
<div>
<input type="button" value="AddDefaultPushpin" onclick="addDefaultPushpin();" />
</div>
</body>
</html>
You can find full documentation on Bing Maps here: http://msdn.microsoft.com/en-us/library/dd877180.aspx
Upvotes: 1