2

I bascially want to create a search in our Sales Orders database to find items that where shipped within a range of a particular address.

I can't use Google's API because: It will be a report and there is no way to display a Map at runtime, which violates the terms of service. Google limits you to 1,600 requests a day, so comparing and arbitrary address to all our sales orders would violate that before 1 search completed. I imagine running the directions API to compare the address to each order in our database would take forever.

MPelletier
  • 16,256
  • 15
  • 86
  • 137
Kratz
  • 4,280
  • 3
  • 32
  • 55
  • How close are you looking? If ZipCode works, you can do that very quick and easy at the DB level. That will take more time – Mitchel Sellers Feb 08 '11 at 15:47
  • So do you need either or both of the following: 1. a geocoding API (text-location/postal code to coordinates) and/or 2. a travel-distance along roads algorithm between two points? You won't need (2) if you only care about straight line distance. – Spacedman Feb 08 '11 at 15:49
  • Precise distance or even driving distance is not necessary. Basically its to determine if our products are installed near a potential customer so they can look at them, so I would be looking for a 100 mile straight line distance or something. – Kratz Feb 08 '11 at 16:35

3 Answers3

4

A lot of this will depend on the precision and exactly what you want to do.

For example, if you want Line of Sight calculations, you can use a service like this one http://geocoder.us/ to get the Latitude and Longitude of each address, from this you can do a simple calculation to get the "as the crow flies" distance between this point and another.

if you want true driving direction distance, that will be much more complicated.

Mitchel Sellers
  • 62,228
  • 14
  • 110
  • 173
  • Good point, I assumed the original author meant straight line or great circle distances. – I82Much Feb 08 '11 at 15:59
  • I think this will work, I can cache the locations by zip code so I don't have to go out to the service everytime. – Kratz Feb 08 '11 at 16:49
  • In that case, you can get the lat/log for zips from Melissa Data to keep locally. (Feel free to e-mail me if you want the SQL to do the distance calculations) – Mitchel Sellers Feb 08 '11 at 20:01
  • I did find a zip code file here http://www.populardata.com/zipcode_database.html, I don't know how old it is, but I don't think the list changes that much. – Kratz Feb 09 '11 at 14:14
0

You could use the Yahoo! geocoding API and cache the lat/lons to the database, and then use the lat/lons and standard mapping library calls to determine the distance to your point of interest.

I82Much
  • 26,901
  • 13
  • 88
  • 119
0

Have you looked at other geocoding APIs, like Yahoo or Bing?

There's also this one, which says it's free and offers a few .NET code samples.

JohnK813
  • 1,134
  • 7
  • 13