PDA

View Full Version : Is it possible to calculate latitud/longitud through address



Learner
03-08-2006, 12:50 AM
Hi there,
Is it possible to calculate latitude and longitude with the help of address. Say you've street address, city, country, post code etc. and you've to calculate the longitude and latitude. Please guide and oblige!
Regards

Wilfried
03-08-2006, 12:15 PM
Hi,

Yes this is good possible. Because each address has a collection of Location objects, however you need a thrick. The CalcPos routine will you find somewhere on this forum (try search on CalcPos). Original in VB fro m Gilles, but various C# copies are posted too. This will start you:


FindResults results = mp.ActiveMap.FindAddressResults(street, city, othercity, region, zip, country);
if &#40;results.ResultsQuality <= GeoFindResultsQuality.geoAmbiguousResults&#41;
foreach &#40;object o in results&#41; &#123;
Location loc = o as Location;
if &#40;loc != null&#41; &#123;
double lat;
double lon;
Pushpin PP = mp.ActiveMap.AddPushpin&#40;loc, ""&#41;;
PP.GoTo&#40;&#41;;
MPTools.CalcPos&#40;mp.ActiveMap, loc, out lat, out lon&#41;;