C# 如何将纬度和经度值转换为地图并显示在页面上
我正在从事一个项目,该服务返回一个包含纬度和经度的xml 示例xml如下:C# 如何将纬度和经度值转换为地图并显示在页面上,c#,asp.net,.net,xml,google-maps,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&g
<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>
60海德公园门肯辛顿伦敦SW7 5BB英国
http://images.gta-travel.com/HH/Images/GB/LON/LON-BAG-2.jpg
64861
51.501545070000000
-0.184810405000000
44-20-73685700
44-20-73685701
我想使用服务提供的纬度和经度显示地图。
我正在使用ASP.NET C#您需要这个吗
我几天前刚做过这件事。
如果你需要帮助,请告诉我。试试这个
string latitude = "51.501545070000000";
string longitude = "-0.184810405000000";
string zoomlevel = "18z";
string url = "https://www.google.no/maps/@" + latitude + "," + longitude + "," + zoomlevel;
Response.Redirect(url);
您可以在您的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
zoom:50,
中心:新google.maps.LatLng(
,
),
mapTypeId:'地形',
街景控制:正确
我尝试使用这个方法,它是有效的,但我遇到的问题是,我创建了一个iframe,在后端我这样做了:mapapi.Attributes.Add(“src”)、“+latitude+”、“+longitude+”、“+zoomlevel”);但是Iframe不显示,并且URL是有效的URL。发布的XML无效。没有根元素。