【问题标题】:How do I convert Latitude and Longitude value to a map and display it on a page如何将纬度和经度值转换为地图并将其显示在页面上
【发布时间】:2015-05-07 10:04:20
【问题描述】:

我正在处理一个项目,该服务返回一个包含纬度和经度的 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#

【问题讨论】:

  • 发布的 XML 无效。没有根元素。

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


【解决方案1】:

你需要这个

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

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

【讨论】:

    【解决方案2】:

    试试这个;

    string latitude = "51.501545070000000";
    string longitude = "-0.184810405000000";
    string zoomlevel = "18z";
    
    string url = "https://www.google.no/maps/@" + latitude + "," + longitude + "," + zoomlevel;
    
    Response.Redirect(url);
    

    【讨论】:

    • 我尝试使用这种方法,它有效,但我遇到的问题是,我创建了一个 iframe,在后端我这样做了:mapapi.Attributes.Add("src" , "google.no/maps/@" + 纬度 + "," + 经度 + "," + 缩放级别);但 iframe 不显示,并且 URL 是有效的 URL
    【解决方案3】:

    你可以在你的 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
    

    【讨论】:

      猜你喜欢
      • 2016-12-19
      • 1970-01-01
      • 2012-01-04
      • 1970-01-01
      • 1970-01-01
      • 2011-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多