Bing Map Optimization Geocoding and Routing Requests

I have a database containing orders, and each order has a corresponding location. Currentl, when the user is logged in, I use the Bing Maps API to geocode each location of the order, and then calculate the distance to the user who is logged in. Based on these distances, the user can use the drop-down list to specify the maximum distances with the results displayed in the gridview. However, with over 100 orders, the process becomes painfully slow. I would appreciate some advice on optimizing either bing requests, possibly caching the results (so that they can be reused without re-processing the api bing cards), or using Ajax to somehow process orders. Thanks.

+7
optimization c # sql ajax bing-maps
source share
2 answers

I plan to do something similar in the very near future, so I have a few suggestions, but no actual code yet. Hope this is helpful.

I expect to store lat / lon for each element in my db (so it is geocoded only once). To select elements at a specific distance from the point, I calculated the lat / lon numbers, which are β€œx” miles north / south / east / west from my center point. Then the choice becomes a simple matter of choosing records, where the lat / lon values ​​fall between the values ​​of my square.

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

I am not familiar with Bing licensing, but if I remember Google correctly, you need to have a paid (commercial) license to store geocoding results. And it’s not cheap. Thus, it can deny any value that my proposal might have: (

Change I just read the question a little more carefully, and I see that we are talking about miles, not linear kilometers. So my answer is not really applicable unless you want to use it as a way to narrow down the number of your driving investigations.

In addition, with regard to geocoding and licenses, you can see geocoder.us , which is pretty cheap.

+1
source share

What you probably want to do is create a minimal spanning tree, assuming you have the same destination for the user. MST is still O (V ^ 2), but you are effectively caching many of the shortest paths, as many of them will reuse the same roads.

Another option is to first evaluate linear distances as a replacement for road miles, but it all depends on what you send back to the user.

Good luck

0
source share

All Articles