Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 3 of 3

Getting direction from one pushpin to another...

This is a discussion on Getting direction from one pushpin to another... within the MapPoint Desktop 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 ...

  1. #1
    jonknapek is offline Junior Member White Belt
    Join Date
    Jul 2005
    Posts
    6

    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

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    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 &#40;lon < 0&#41;	// Western direction
    		bear = 360 - bear;
    	return bear;
    &#125;

  3. #3
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4
    Bear down, Chicago Bears!
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Drawing radius in the wind direction
    By vidyakulkarni in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 09-10-2004, 03:45 PM
  2. Mappoint direction HELP
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 07-29-2003, 04:52 PM
  3. How to Add pushpin to a MapPoint Direction every 50m.?
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 06-26-2003, 03:15 PM
  4. Export MapPoints Direction to GPS File. HELP
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 06-20-2003, 03:09 AM
  5. Fix Direction Location
    By Bob Chase in forum Wish List
    Replies: 0
    Last Post: 03-21-2003, 06:31 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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