我正在尝试使用 Windows 8 Metro 应用程序的 BING 地图 API 获取印度特定城市的所有医院。但是我无法获取详细信息。以下是尝试过的两种方法
使用 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; } } }
这没有提供所需的详细信息。
- 使用必应空间数据服务
以下是代码片段
////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,
};
但是,我没有获得印度城市所需的详细信息。有人可以帮我弄清楚需要做什么才能获取正确的详细信息吗?