XAML 必应Map获取医院

5gfr0r5j  于 2023-03-27  发布在  其他
关注(0)|答案(1)|浏览(93)

我尝试使用Windows 8 Metro应用程序的BING Map API获取印度特定城市的所有医院。但我无法获取详细信息。以下是尝试的两种方法
1.使用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;
            }
        }
    }

这并没有提供所需的详细信息。
1.使用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,
               };

然而,我没有得到所需的详细信息,在印度的城市。有人可以帮助我弄清楚需要做什么,以获取正确的细节?

ztyzrc3y

ztyzrc3y1#

场馆Map仅是BingMap提供室内平面图的位置。我不知道印度有任何医院可以作为场馆Map使用。Bing空间数据服务中的兴趣点数据仅在北美和欧洲可用。在印度查找位置的最佳选择是使用BingMapSOAP搜索服务。
http://msdn.microsoft.com/en-us/library/cc980849.aspx
http://msdn.microsoft.com/en-us/library/dd221354.aspx

相关问题