在Web应用程序中使用Bing Map [英] Using Bing Map in web application

查看:81
本文介绍了在Web应用程序中使用Bing Map的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Web应用程序中使用bing map,并且我具有javascript函数来显示地图,添加图钉
以下是功能

I am using bing map in my webapplication and i have javascript functions to display map, add push pin
Below are the functions

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;
      }
}


我需要
1)将纬度和经度作为参数从我的vb.net代码传递到"setMapLocation" javascript函数
2)获取"DisplayLoc" JavaScript函数的返回值,该返回值是vb.net代码的经度和纬度.
有人可以帮我怎么做....


I need to
1) pass latitude and longitude as parameter from my vb.net code to "setMapLocation" javascript function
2) get return value of "DisplayLoc" javascript function which is latitude and longitude to vb.net code.
Can anyone help me how to do this please....

推荐答案

我们可以使用Google Maps而不是Microsoft Map,并且其api在Google Labs和Google中都可以轻松获得应用.
Instead of Microsoft map we can use google Maps and its api is easily available in Google Labs and Google apps.


这篇关于在Web应用程序中使用Bing Map的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆