2013-07-26 58 views
0

我正嘗試使用BING Map API for Windows 8 Metro應用程序獲取印度特定城市的所有醫院。但是我無法獲取細節。以下是與試圖必應地圖獲取醫院

  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, 
       }; 

但是我沒有得到所需的細節在印度城市。有人能幫我弄清楚需要做什麼才能獲取正確的細節?

+0

http://msdn.microsoft.com/en-us/library/bb259692.aspx – zod

+0

其提供的鏈接是AJAX控制。這可以在Windows 8城域應用程序中使用嗎? –

回答

0

場地地圖只是Bing地圖有室內平面圖的位置。我不知道印度有哪些醫院可以作爲場館地圖。 Bing Spatial Data服務中的興趣點數據僅在北美和歐洲可用。在印度尋找位置的最佳選擇是使用Bing Maps SOAP搜索服務。

http://msdn.microsoft.com/en-us/library/cc980849.aspx

http://msdn.microsoft.com/en-us/library/dd221354.aspx

+0

可以在Windows 8 Store App中使用BING映射SOAP服務嗎? –

+0

是的。將其添加爲服務參考。 – rbrundritt

+0

謝謝@rbrundritt。我一定會試着讓你知道。 –