我正嘗試使用BING Map API for Windows 8 Metro應用程序獲取印度特定城市的所有醫院。但是我無法獲取細節。以下是與試圖必應地圖獲取醫院
使用NearbyVenueCollection類
NearbyVenueOptions options = new NearbyVenueOptions(loc, 10000); NearbyVenueCollection nearbyVenues = null; try { nearbyVenues = await MyMap.VenueManager.GetNearbyVenuesAsync(options); ; } catch (Exception) { } if (nearbyVenues != null && nearbyVenues.Count > 0) { foreach (var nearbyVenue in nearbyVenues) { if (nearbyVenue.Metadata.VenueType == VenueType.Hospital.ToString()) { string name = nearbyVenue.Metadata.Name; } } }
這不是提供所需的詳細信息的兩種方法。
- 使用Bing空間數據服務
以下是代碼片段
////Create the Bing Spatial Data Services request to get nearby POI
string findNearbyPOIRequest = "http://spatial.virtualearth.net/REST/v1/data/ f22876ec257b474b82fe2ffcb8393150/ NavteqNA/NavteqPOIs? spatialfilter=nearby("
+ loc.Latitude + "," + loc.Longitude + "," + 1000 + ")"
+ "&$filter=EntityTypeID%20EQ%20'" + "8060" + "'& $select=EntityID,DisplayName,__Distance,Latitude,Longitude,AddressLine, Locality,AdminDistrict,PostalCode,Phone&$top=20"
+ "&key=" + BingCredentials;
Uri uri = new Uri(findNearbyPOIRequest);
WebRequest request = WebRequest.Create(uri);
// GetResponseAsync() returns immediately after the header is ready
WebResponse response = await request.GetResponseAsync();
Stream inputStream = response.GetResponseStream();
XDocument doc = XDocument.Load(inputStream);
XNamespace m ="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata";
XNamespace d = "http://schemas.microsoft.com/ado/2007/08/dataservices";
MapLayer pushpinLayer = new MapLayer();
pushpinLayer.Name = "Push Pin Layer";
var elements = from nodes in doc.Descendants(m + "properties")
select new
{
Name = nodes.Element(d + "DisplayName").Value,
Latitude = nodes.Element(d + "Latitude").Value,
Longitude = nodes.Element(d + "Longitude").Value,
Address = nodes.Element(d + "AddressLine").Value,
};
但是我沒有得到所需的細節在印度城市。有人能幫我弄清楚需要做什麼才能獲取正確的細節?
http://msdn.microsoft.com/en-us/library/bb259692.aspx – zod
其提供的鏈接是AJAX控制。這可以在Windows 8城域應用程序中使用嗎? –