none
How to use Bing Spatial service to get nearby areas and how to add them to our map control RRS feed

  • Question

  • I am using query Api to get the near by locations with in given radius. How to add them to our map control and bind them to a UI control.

    public class SpatialDataQuerying
    {
       static void Main()
       {
       SpatialDataQuerying queryTest = new SpatialDataQuerying();
       queryTest.RunExampleQueries();      
       }
    
       public void RunExampleQueries()
       {
          ExampleFindByAreaRadius();   
       }
       public async void ExampleFindByAreaRadius()
         {
          string dataSourceName = "petrolbunk";
          string dataEntityName = "petrolbunk";
    
          string accessId = DataSourceID;
    
          string bingMapsKey = BingMapsKey;
    
          double SearchLatitude = 47.63674;
          double SearchLongitude =  - 122.30413;
    
          double Radius = 3;      
          string requestUrl = string.Format("http://spatial.virtualearth.net/REST/v1/data/{0}/{1}/{2}" + "?spatialFilter=nearby({3},{4},{5})&key={6}",accessId,dataSourceName,
        dataEntityName,SearchLatitude, SearchLongitude, Radius, bingMapsKey);

    As you know after this query the url is sent through HTTP web request.

    HttpWebRequest request = WebRequest.Create(requestUrl) as HttpWebRequest;
    HttpWebResponse response = await request.GetResponseAsync() as HttpWebResponse;
    Now how to store this response to a list and display them in map control. Also how to bind the area to our UI control.


    Monday, October 19, 2015 7:21 AM

Answers