如何将纬度和经度值转换为地图并将其显示在页面上

时间:2015-05-07 10:04:20

标签: c# asp.net .net xml google-maps

我正在处理一个项目,该服务返回一个包含纬度和经度的xml 示例xml如下:

 <Address>60 Hyde Park Gate Kensington London SW7 5BB United Kingdom</Address> 
<Image>http://images.gta-travel.com/HH/Images/GB/LON/LON-BAG-2.jpg</Image> 
<LPrice>64861</LPrice> 
<Latitude>51.501545070000000</Latitude> 
<Longitude>-0.184810405000000</Longitude> 
<Phone>44-20-73685700</Phone> 
<Email /> 
<Fax>44-20-73685701</Fax>  

我想使用服务提供的纬度和经度来显示地图。 我正在使用ASP.NET C#

3 个答案:

答案 0 :(得分:1)

你需要这个

http://www.aspsnippets.com/Articles/Show-Google-Maps-using-Latitude-and-Longitude-in-ASPNet.aspx

几天前我就这样做了。 如果您需要任何帮助,请告诉我。

答案 1 :(得分:0)

试试这个;

string latitude = "51.501545070000000";
string longitude = "-0.184810405000000";
string zoomlevel = "18z";

string url = "https://www.google.no/maps/@" + latitude + "," + longitude + "," + zoomlevel;

Response.Redirect(url);

答案 2 :(得分:0)

您可以在aspx中使用下面的内容

zoom: 50,
center: new google.maps.LatLng(
    <%= string.Format(CultureInfo.InvariantCulture.NumberFormat, 
        "{0:0.0000}", YourLatitude) %>,
    <%= string.Format(CultureInfo.InvariantCulture.NumberFormat, 
        "{0:0.0000}", YourLongitude) %>),
mapTypeId: 'terrain',
streetViewControl: true