View Single Post

  #1 (permalink)  
Old 08-22-2002
Petr Brant Petr Brant is offline
Junior Member
White Belt
 
Join Date: Aug 2002
Posts: 1
How to find nearest city?

Hi all,
I work with MS MapPoint 2002 under Delphi using TOleContainer. Everything works fine, but I have this problem: I have Lat and Long and want to search for nearest city. I need name of the city and name of the country, where it resides. I use this code:

Code:
 Dist:= 1;
 Loc:= self.GetLocation(X, Y);
 Results:= Loc.FindNearby(Dist);
 while (Results.Count = 0) and (Dist < CMaxDist) do
 begin
  Results:= Loc.FindNearby(Dist);
  Dist:= Dist*2;
 end;
 if Results.Count > 0 then //here I have all locations
...
But in Results are Hotels, Restaurants, etc. How to obtain nearest city name?

Thanks for all replies. Bye Petr
Reply With Quote