MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




How to find nearest city?

This is a discussion on How to find nearest city? within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi all, I work with MS MapPoint 2002 under Delphi using TOleContainer. Everything works fine, but I have this problem: ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-22-2002
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 08-22-2002
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
One of the problems with the FindNearby method is results are limited to the CURRENTLY VISIBLE PlaceCategory objects (Like Restaurants, Airports etc..) So even if there is/was a way to get the city from the nearest "Place" the results could not be depended on.

A better approach might be what David is exploring (Also Delphi).

http://www.mp2kmag.com/mappoint/disc...pic.asp?t=3187
__________________
John
http://www.support-pc.com

Order MapPoint 2006 Here
https://secure.mp2kmag.com/?refer=support-PC
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 08-22-2002
Junior Member
Yellow Belt
 
Join Date: Aug 2002
Posts: 13
Hi Petr, as said above I am doing the same sort of thing although I am searching for the nearest road from a point so I can get a postcode.

The Map.ObjectsFromPoint method:

Code:
mpResults := mpMap.ObjectsFromPoint(mpMap.LocationToX(mpLocation), mpMap.LocationToY(mpLocation));
The above converts the Given location to a X,Y point on the Map it then searches for any Nearby Objects, roads, places of interest, towns etc..
__________________
"If it ain't broke don't fix it!"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 08-23-2002
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
Ran accross this on MSDN

ZIP Code - City Finder Sample Code
http://msdn.microsoft.com/library/de...asp?frame=true
__________________
John
http://www.support-pc.com

Order MapPoint 2006 Here
https://secure.mp2kmag.com/?refer=support-PC
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
city, find, nearest


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
How to retrieve nearest city from longitudes and latitud fsarraj MapPoint 2006/2009 Discussion 3 03-08-2006 01:22 PM
find nearest locality Anonymous MapPoint 2006/2009 Discussion 0 07-09-2003 04:26 AM
nearest city of a point Anonymous MapPoint 2006/2009 Discussion 0 04-07-2003 07:46 AM
Find city which are placed to x km or miles of a place Anonymous MapPoint 2006/2009 Discussion 0 12-09-2002 08:11 AM
Given a city find zip codes? amanuel MapPoint 2006/2009 Discussion 0 09-21-2002 01:32 PM


All times are GMT -5. The time now is 07:10 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54