Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Optimizing Bing Maps Geocode and RouteMapping requests

I have a database containing orders and each order has an associated location. Currentl, when a user is logged in ,I am using Bing Maps API to geocode each order location and then compute driving distance to the logged in user. Based on these distances, the user via a dropdownbox can then specify the maximal distances with the results displayed in a gridview. However, with more than 100 orders the process becomes painfully slow. I would appreciate some tips on optimizing either the bing queries, possibly caching the results(so they can be reused without reaccessing the bing maps api) or utilizing Ajax to somehow background process the orders. Thanks.

like image 566
Rotimi Avatar asked Feb 15 '10 17:02

Rotimi


People also ask

Does Bing Maps have an API?

Data ManagementThe Bing Maps API platform offers access to an extensive and accurate set of geographic boundary information with the GeoData API. Developers can use this API to create apps using geolocation data to reflect accurate boundaries for states, cities, counties, and even zip codes.

Is Bing Geocoding API free?

Developer. Developers can use the Basic Key for building location intelligence-based apps with Bing Maps API for free. Educational institutions and non-profits are also free to build with the Basic Key.

Which is better Bing or Google Maps?

Google Maps leads in the market in top 10K, 100K and 1M sites and even the entire web. However, Bing Maps lags far behind and loses to Google Maps in all segments. When you compare the two, Google Maps has better usage coverage in website categories like business & industry, travel, shopping, and Arts & entertainment.


1 Answers

I am planning to do something similar in the very near future, so I have a few suggestions, but no actual code to share yet. I hope it is useful.

I expect to store the lat/lon for each item in my db (so it is geocoded only once). To select items within a certain distance from a point, I will calculate the lat/lon numbers which are 'x' miles north/south/east/west of my center point. Then the selection becomes a simple matter of picking records where the lat/lon values fall between the values of my square.

And yes, I know that technically I should use a circle to precisely control the distance, but this is so much easier and faster. If you really need to use a circle for a more precise limit, use this method first, then use more complex calculations to weed out the items outside the circle in the corners.

I am not familiar with Bing's licensing, but if I remember correctly about google, you need to have a paid (commercial) license to store the results of geocoding. And it ain't cheap. So that may negate any value my suggestion might have had :(

Edit; I just read the question a little more carefully, and I see that it is talking about driving miles, not linear miles. So, my answer isn't really applicable, unless you want to use it as a way to narrow down the number of driving distance calculcations you have to do.

Also, on the subject of geocoding and licenses, you could look at geocoder.us which is pretty cheap.

like image 131
Ray Avatar answered Oct 18 '22 19:10

Ray