Gianmaria
05-13-2005, 09:47 AM
Hi All,
i'm using this function.. and i wonnna share this with other members.. it seem that many have the same question.. how do i transform a lat/lon to a valid address.. here we go.. this is the function i use..
public override string getAddress(double lat, double lon)
{
string address = "";
MapPoint.FindResults results;
MapPoint.Location mLoc = this.mMap.Location.Location;
mLoc = this.mMap.GetLocation(lat, lon);
results = this.mMap.ObjectsFromPoint(this.mMap.LocationToX(m Loc), this.mMap.LocationToY(mLoc));
foreach (object o in results)
{
try
{
MapPoint.Location Loc = (MapPoint.Location)o;
if (Loc != null)
{
address += Loc.StreetAddress.City + " - " + Loc.StreetAddress.Street;
}
}
catch(System.Exception ex)
{
}
}
System.Diagnostics.Trace.WriteLine(address);
return address;
}
this is c# code.. but can be easly transformned to vb.
I've got a question bout the way mappoint handles this problem to.. the result of this functions vary from map zoom in my app.. at different zoom i have different results.. for someone knows much.. is there a way to get the most precise info????
regards,
Gianmaria
i'm using this function.. and i wonnna share this with other members.. it seem that many have the same question.. how do i transform a lat/lon to a valid address.. here we go.. this is the function i use..
public override string getAddress(double lat, double lon)
{
string address = "";
MapPoint.FindResults results;
MapPoint.Location mLoc = this.mMap.Location.Location;
mLoc = this.mMap.GetLocation(lat, lon);
results = this.mMap.ObjectsFromPoint(this.mMap.LocationToX(m Loc), this.mMap.LocationToY(mLoc));
foreach (object o in results)
{
try
{
MapPoint.Location Loc = (MapPoint.Location)o;
if (Loc != null)
{
address += Loc.StreetAddress.City + " - " + Loc.StreetAddress.Street;
}
}
catch(System.Exception ex)
{
}
}
System.Diagnostics.Trace.WriteLine(address);
return address;
}
this is c# code.. but can be easly transformned to vb.
I've got a question bout the way mappoint handles this problem to.. the result of this functions vary from map zoom in my app.. at different zoom i have different results.. for someone knows much.. is there a way to get the most precise info????
regards,
Gianmaria