finding distance between two UK addresses
I need to write an application which is to calculate the estimated driving distance between two UK addresses; I think I can use Google as following:
http://maps.google.com/maps/nav?q=from:London%20to:Dover
However, anyone knows what is the daily/monthly limit of querying the database from a single IP address?
I need to implement in a commercial application (freight services), is there any re开发者_如何学运维liable alternative? I can spend some money; but 'some';
Development language/platform: C#, .NET
Regards,
You could use OpenStreetMaps database and do the calculation yourself, but that would involve some coding.
You could use openstreetmap with pgrouting in postgis if all you care about is rough estimates. If you are just doing city to city then you really don't have to worry about geocoding all that much since the lat longs cities is fairly well know.
If your service is constrained to England I would keep a large DB table of the combinations for the pairwise distance of the top 5000 cities. Compute it once offline using pgrouting and then call that when the request comes in. This would make the app much much faster for most of your users.
All the major map players have routing APIs (Yahoo, Bing, MapQuest, Nokia) You could also look at deCarta for the same kind of service. They were the LBS engine behind Yahoo and Google for quite some time.
[update] if you are just doing this for a rough estimate do you really need to do routing or can you just do straight line distance. Straight line is much much simpler to solve. You just need the lat longs for the centers of the cities without the street network data or doing the routing calculations.
As of April 1st, The Ordnance Survey have released a lot of their data, including their Code-Point product as a free download from their website. It has also been mirrored by MySociety which includes conversion to WGS84 co-ordinates (i.e. those used by GPS devices) from which it would then be fairly trivial to calculate the great circle distances between the two points - trivial enough that it could be part of a SQL query if you have the points in a database.
If you need to be more accurate for actual driving distances, you could also download the Meridian data, and implement a fairly basic routing algorithm (Djakstra might be meaningful here)
Usually, most road shapefiles have a begin_address/end_address fields for each road segment where you can interpolate the addresses. The bottom line is that you have a GIS problem manifesting in gathering and organizing the address data, the NP stuff in my opinion is the simpler problem.
Look into postgis. You can convert shape files to it. the irc room #postgis on irc.freenode.net is extremely helpful so is there mailing list.
You can legally use Google Maps in commercial certain types of applications. They grant you a license and an API key to embed in your page code. There are, of course, some restrictions. See http://code.google.com/apis/maps/terms.html.
[Edited to clarify. You can use it if you're not making any money directly from it, which was the OP's intent.]
How about 2-5 pence per query, pay-as-you-go, through postcodeanywhere.co.uk. They work with the AA, so their data is probably quite accurate and complete.
Might save you some development time (which also translates to money). Check with the bean counters whether it's worth 2 pence per quote. If not, you could possibly run the X most popular trips through their service and cache the results (might violate their terms and conditions, check first).
I have solved the problem using Google Maps and I have written custom API using Newtonsoft JSON.
I haven't yet posted solution anywhere on blog ( will do soon ).
If anyone is interested in getting piece of code, please ping me.
精彩评论