tags:

views:

155

answers:

6

Hello;

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 reliable alternative? I can spend some money; but 'some';

Development language/platform: C#, .NET

Regards,

A: 

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.]

John M Gant
... you must not ...10.4 charge users or any other third party any fee for the use of the Maps API Implementation, the Service, or the Content, unless you have entered into a separate written agreement with Google or obtained Google's written permission to do so
Axarydax
thanks Axarydax for pointing out; however, my app will not charge for the usage of Google Maps, neither it will be used to calculate the freight charges, it will be used for rough quote;a
effkay
10.6 you must not use the Service or Content... in connection with... dispatch, fleet management... or similar
MarkJ
@MarkJ: what he's talking about isn't dispatch or fleet management (or similar); it's for estimating freight charges.
John M Gant
+4  A: 

You could use OpenStreetMaps database and do the calculation yourself, but that would involve some coding.

Axarydax
I am ready for coding; any hint for that?
effkay
There's loads on the Wiki at: http://wiki.openstreetmap.org/wiki/Develop see also http://sourceforge.net/projects/travelingsales/
Rowland Shaw
A: 

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.

dassouki
I think obtaining the road vector data cheaply will be the first problem.
MarkJ
+2  A: 

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.

TheSteve0
Straight line distance could be misleading for some trips? Dover to Norwich might get the truck a bit damp on a straight line journey:)
MarkJ
Agreed but you definitively have to pay decent money for routing algorithms that understand that and it seemed like cost was a pretty big concern.
TheSteve0
A: 

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).

MarkJ
A: 

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)

Rowland Shaw