Community of VE/MapPoint Users and Developers
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 ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
|
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;
}
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
![]() |
| Tags |
| direction, pushpin |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| 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 |