none
Getting nearby restaurants and grocery stores list with latitude longitude information RRS feed

  • Question

  • I am developing a Windows Phone 7  application using Bing Map Services. I have some custom locations which I can display on the Bing Maps. I would like to overlay on this map  nearby restaurants, grocery stores etc.

    I would like to query Bing map search services using the address of the user location (or latitude and longitude information) and get a location (latitude, longitude) list of nearby restaurants grocery stores etc.

    Once I have the information I know how to do the overlay on the Bing Maps.

    I am looking for help on how to get the list of grocery stores and restaurants with latitude and longitude information. Which Bing services should I use to get this list.

    • Moved by Ricky_Brundritt Friday, March 9, 2012 1:47 PM (From:Bing Maps: Map Control and Web services Development)
    Thursday, January 6, 2011 9:22 PM

Answers

All replies

    • Use reverse find and find out the address for your geocoordinate VEMap.FindLocations(veLatLong, callback);
    • Then use the above address to find nearby POIs

    Below is a code sample for reverse find from Bing maps Interactive SDk


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
       <head>
          <title>VEMap.FindLocations()</title>
          <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

          <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2"></script>

          <script type="text/javascript">
             var map = null;
             var locations = null;
             var pixel = null;
             var clickEvent = null;
             var LL = null;

             function GetMap()
             {
                map = new VEMap('myMap');
                map.LoadMap();

                map.AttachEvent("onclick", PixelClick);

             }

             function PixelClick(e)
             {
                var x = e.mapX;
                var y = e.mapY;
                pixel = new VEPixel(x, y);
                LL = map.PixelToLatLong(pixel);

                map.FindLocations(LL, GetResults);

             }


             function GetResults(locations)
             {
               var s="Results for " + LL.Latitude + ", " + LL.Longitude + ": ";
                if(locations != null)
                {
                  s+=locations[0].Name;
                  
                }
                else
                {
                   s+="No Result found.";
                }

                alert(s);
             }

          </script>
       </head>
       <body onload="GetMap();">
          <div id='myMap' style="position:relative; width:600px; height:400px;"></div>
          <br>Click on the map to display location information.<br/>
       </body>
    </html>
         

    Hope this helps.  Please let me know if you have any questions.


    Aditya Tadakaluru MCPD, MCITP, MCTS(Bing Maps)
    Friday, January 7, 2011 5:30 PM
  • Thanks for the replies, however these seem to be Javascript examples. I am using the Bing Map Silverlight control in  Windows Phone 7. I would like examples in C# if possible.

    I know how to

    convert address to latitude, longitude

    Convert latitude, longitude to address.

    The problem I am trying to solve is to find nearby restaurants  and grocery stores with the user location.

    Thanks.

    Friday, January 7, 2011 6:32 PM
  • Sunday, January 9, 2011 7:20 AM
  • You need to use the StructuredQuery property of the SearchRequest class, passing the location in the Location property in the format "latitude, longitude", like this:
    // Define a structured query to look for grocery stores near a lat/long coordinate
    StructuredSearchQuery SSQ = new StructuredSearchQuery();
    SSQ.Location = "52.62, 1.295";
    SSQ.Keyword = "grocery";
    
    // Pass the query to the SearchRequest
    SearchRequest searchRequest = new SearchRequest();
    searchRequest.StructuredQuery = SSQ;
    


    Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290
    Sunday, January 9, 2011 10:12 AM
    Moderator
  • Since this is a topic that's come up a lot recently, I've just written a blog article that might help you: http://alastaira.wordpress.com/2011/01/09/the-bing-maps-soap-search-service/
    Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290
    Sunday, January 9, 2011 9:07 PM
    Moderator