MapPoint Forums

MapForums

Community of MapPoint and Virtual Earth Users and Developers




How to retrieve nearest city from longitudes and latitud

This is a discussion on How to retrieve nearest city from longitudes and latitud within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hello I have an application over Visual C++ and i need to find the nearest city to an geografic point ...


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

Today's Posts Twitter Feed 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 03-07-2006
Junior Member
White Belt
 
Join Date: Mar 2006
Posts: 3
How to retrieve nearest city from longitudes and latitud

Hello

I have an application over Visual C++ and i need to find the nearest city to an geografic point (latitud , longuitud ) . I have the following code but is crashing in the GetStreetAddress() function. Does anyone have any idea ??


Code:
CLocation loc,streetLoc;
			CFindResults streetResults;
			CStreetAddress callejero;
	
		    loc = mapa.GetLocation(lat, lon, 0);
            loc.GoTo();

            streetResults = mapa.ObjectsFromPoint(mapa.LocationToX(loc), mapa.LocationToY(loc));

			int numResult=streetResults.GetCount();
			int i=1;
			while ( i <=numResult)
			{
				
				VARIANT idx;
				VariantInit( &idx );
				V_VT(&idx) = VT_I4;
				V_I4(&idx) = 1;
				
				streetLoc=streetResults.GetItem( &idx );
				
				szLocalidad=streetLoc.GetLocation().GetName();

				callejero=streetLoc.GetStreetAddress();
							
				i++;
			}
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 03-07-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,177
Hi,

"Crashing" does not mean muthc. Put you code into an exeption blockand reply with the exact error you have. This way we can help more.
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 03-08-2006
Junior Member
White Belt
 
Join Date: Mar 2006
Posts: 3
I have done , my excepction is produced in the line
Code:
callejero=streetLoc.GetStreetAddress();
and gives the following exception "menber not found".
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 03-08-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,177
Hi,

I dont think there is a GetStreetAddress method in a Location object. I think what you are looking for is the StreetAddress property, so:

Code:
callejero = streetLoc.StreetAddress;
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, latitud, longitudes, nearest, retrieve


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 complete address from longitudes and latitud Learner MapPoint 2006/2009 Discussion 14 01-04-2007 08:40 AM
Is it possible to calculate latitud/longitud through address Learner MapPoint 2006/2009 Discussion 1 03-08-2006 12:15 PM
MapPoint can't import near-zero longitudes? random MapPoint 2006/2009 Discussion 6 08-25-2004 09:03 AM
nearest city of a point Anonymous MapPoint 2006/2009 Discussion 0 04-07-2003 06:46 AM
How to find nearest city? Petr Brant MapPoint 2006/2009 Discussion 3 08-23-2002 01:49 PM


All times are GMT -5. The time now is 11:49 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 RC2
MP2K Magazine
Visitor Map

Bodrum Holiday
Check out the picturesque towns on your Bodrum holiday... Book through UlookUbook!



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 55 56 57 58 59