MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Getting direction from one pushpin to another...

This is a discussion on Getting direction from one pushpin to another... within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Is there a way to get the direction, N, S, E, W, etc., from one Pushpin to another? Thanks, Jonathan ...


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 11-15-2005
Junior Member
White Belt
 
Join Date: Jul 2005
Posts: 6
Send a message via AIM to jonknapek
Getting direction from one pushpin to another...

Is there a way to get the direction, N, S, E, W, etc., from one Pushpin to another?

Thanks,
Jonathan Knapek
__________________
Jonathan Knapek
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 11-15-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

This function calculate the bearing between a vehicle's current position and the endpoint it has to go (hence it's name). It does exacly what you ask. The (lat1 + lat2) / 2 is to get the middlepoint of it to correct longitude if we ar not on equator.

Code:
u_16 get_bearing(double lat1, double lon1, double lat2, double lon2)
{
	double lat  = lat2 - lat1;
	double lon  = (lon2 - lon1) * cos(deg2rad((lat1 + lat2) / 2));
	double dist = hypot(lat, lon);
	double bear = rad2deg(acos(lat / dist));
	
	if (lon < 0)	// Western direction
		bear = 360 - bear;
	return bear;
}
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 11-16-2005
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,480
Blog Entries: 1
Bear down, Chicago Bears!
__________________
~ Now taking orders for MapPoint 2009 ~
~
~ Upgrade to MapForums Plus membership ~
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
direction, pushpin


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
Drawing radius in the wind direction vidyakulkarni MapPoint 2006/2009 Discussion 0 09-10-2004 03:45 PM
Mappoint direction HELP Anonymous MapPoint 2006/2009 Discussion 0 07-29-2003 04:52 PM
How to Add pushpin to a MapPoint Direction every 50m.? Anonymous MapPoint 2006/2009 Discussion 3 06-26-2003 03:15 PM
Export MapPoints Direction to GPS File. HELP Anonymous MapPoint 2006/2009 Discussion 2 06-20-2003 03:09 AM
Fix Direction Location Bob Chase Wish List 0 03-21-2003 06:31 AM


All times are GMT -5. The time now is 01:43 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