Hello,
1. Is it possible to get geolocation from ZIP code only?
2. How to calculate a distance between 2 markers?
Thanks
- A ZIP code alone is not sufficient, you'd need the country too.
2) Such distance calculation is currently not built-in but being considered for a future update
Hi,
I don't know if this will help you, but if you have the longitude and lattitude of the 2 points I believe one function for calculating distance is:
function Distance(lon1,lat1,lon2,lat2: Single): single;
var
dlat,
dlon: single;
a,c,d: single;
begin
lat1:=degtorad(lat1);
lon1:=degtorad(lon1);
lat2:=degtorad(lat2);
lon2:=degtorad(lon2);
var
dlat,
dlon: single;
a,c,d: single;
begin
lat1:=degtorad(lat1);
lon1:=degtorad(lon1);
lat2:=degtorad(lat2);
lon2:=degtorad(lon2);
result:=ARCCOS(SIN(lat1)*SIN(lat2)+COS(lat1)*COS(lat2)*COS(lon2-lon1))*3956.545;
end;
By the way, this function is pretty accurate within a city or between cities in a state. But, it does not take into account things like the bulge due to the rotation of the Earth, etc. So, it is not as accurate between say LA and Paris