PDA

View Full Version : Reverse Geocoding



tea_boy
11-09-2006, 11:14 AM
Hi i am trying to get the street address, or at least the city or region from a lat/long coord. I have implemented a simple algorithm that uses the
findNearby method to find the closest point of interest, which i can then get the address of. However when i call findnearby the screen jumps to the to the location and displays a circle representing the radius of the area im looking in.

I have managed to stop the jump by using the GoBack() method directly after the findnearby call, however the circle is still displayed. Does anyone know of a way to hide this circle?

A second question is that i saw a similar method to the one i have implemented that used the ObjectsFromPoint method, which i assume returns an object at a given point?? if anyone could clear this up for me i
would appreciate it

thanks tea_boy

Wilfried
11-10-2006, 12:58 PM
Hi,


Location loc = MP.ActiveMap.GetLocation(lat, lon, alt);
loc.GoTo();
FindResults streetResults = map.ObjectsFromPoint(map.LocationToX(loc), map.LocationToY(loc));
foreach (object o in streetResults) {
Location streetLoc = o as Location;
if(streetLoc != null && streetLoc.StreetAddress != null) {
Console.WriteLine("value " + streetLoc.StreetAddress.Value);
Console.WriteLine("city " + streetLoc.StreetAddress.City);
Console.WriteLine("country " + streetLoc.StreetAddress.Country);
}
}

You can play with altitude a bit to have your results. 1 (1 km or mile depending on your settins) will normally give statisfaction results.