-1

Possible Duplicate:
Calculating distance between zip codes in PHP

Let's say I have two different post codes with the same or different country. Is there any API to count the distance between those two? Thanks.

Not necessary in PHP.

Community
  • 1
  • 1
good_evening
  • 21,085
  • 65
  • 193
  • 298
  • I'm not familiar with any out-of-the-box PHP API that can do this. I have a geo-location database for the USA that provides lat/long coordinates for each post code. A MySQL query using trig (cosine and sine calculations I believe) can coordinate the distance between any two post codes. – Patrick Moore Nov 04 '11 at 20:20
  • Some postcodes (e.g. in the UK) sadly are copyrighted commercial property, and so you have to pay to get a copy of the postcode->coordinate database. – halfer Nov 04 '11 at 21:27

1 Answers1

0

Have a look at Google's geocoding service, which is now free of charge:

http://code.google.com/intl/en/apis/maps/documentation/geocoding/#GeocodingRequests

At least for germany, Google maps resolves

ZIP Code, Country

sequences like on this page.

SteAp
  • 11,853
  • 10
  • 53
  • 88