Get All City Name within specified radius RRS feed

  • Question

  • hi,

    I am new to bing map.I have following requirement can anyone help me out with this.

    input 1: source(zipcode or lat  or long)

    input 2:destination(zipcode or lat or long)

    radius:2 miles

    based on this input i need to get all city between source and destination that are within 2 mile radius and show pinpoint on map.



    Thursday, March 14, 2013 7:08 AM


  • This isn't something that would be easy to do in Bing Maps as it's more of a spatial data calculation than a visualization thing. I'm assuming that the start and end points could be a long distance away from each other and that the radius is around that direct path. If this is the case your best approach is to use SQL server and it's spatial tool. Start off by getting a database of all the cities in the world ( and then upload them into SQL server. Then add a column to the database of type Geography and then generate a Point object from each set of coordinates and give them a buffer in meters for a specific radius. This will essentially create a bunch of circles, one for each city. Once that is done you could create a stored procedure that takes your start and end coordinates, creates a LineString object and then gives it a buffer of a specified radius in meters. This will generate a polygon. Finally you can take this polygon and do an intersection check against all the city circles to see which one's overlay, thus giving you an approximate list of all the cities that are between two points on the globe. Also, remember that the LineString will likely take the shortest path around the globe between your points, which means it could cross the international date line. For example drawing a line from Beijing to Hollywood would likely cross the pacific ocean and possibly return cities in Hawaii, instead of going the long way around across Asia and Europe.

    Thursday, March 14, 2013 11:37 AM