Saya mencoba mengambil semua rumah sakit untuk kota tertentu di India menggunakan BING Map API untuk aplikasi Windows 8 Metro. Namun saya tidak dapat mengambil detailnya. Berikut adalah dua pendekatan yang dicoba
Menggunakan kelas NearVenueCollection
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; } } }
Ini tidak memberikan rincian yang diperlukan.
- Menggunakan Layanan Data Spasial Bing
Berikut cuplikan kodenya
////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,
};
Namun saya tidak mendapatkan rincian yang diperlukan untuk kota-kota di India. Dapatkah seseorang membantu saya mencari tahu apa yang perlu dilakukan untuk mendapatkan detail yang benar?