Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#1827 closed defect (fixed)

Measure Distance - Bearing

Reported by: voncasec Owned by: grass-dev@…
Priority: normal Milestone: 6.4.3
Component: wxGUI Version: svn-releasebranch64
Keywords: Bearing tool, MapFrame.MeasureDist() Cc:
CPU: x86-64 Platform: Linux


Currently, when using the measure tool in the map display (Analyze Map -> Measure Distance) the Bearing results appear upside down. The calculated bearings are as follows:

North (180)

West (270) - East (90)

South (0)

I did a search through some active tickets, and there were some open tickets with reference to bearing calculations. These tickets were 3-4 years old, so I am unsure of it they are still valid or not. If they are, I apologize for this additional ticket.

Change History (4)

comment:1 by neteler, 11 years ago

Other candidate tickets:

  • Ticket #76: enhancement: Calculation of bearing between 2 points, using d.measure
  • Ticket #558: enhancement: Decimal degree and Z support added to m.cogo
  • Ticket #193: enhancement: metes and bounds converter (new)

comment:2 by hamish, 11 years ago

Component: DisplaywxGUI
Keywords: MapFrame.MeasureDist() added
Resolution: fixed
Status: newclosed

yes, the N-S was calculated backwards in the wxGUI. fixed in all branches with r55801-4.

It also now states the convention used, since this one is backwards as to how grass typically measures it. (here using navigational convention instead of mathematical one) If you want the standard GRASS way (reporting theta CCW from the +x axis) uncomment the line in as documented in the code.

I am glad to see MapWindow.Distance using G_distance() via ctypes for geodesic distance in lat/lon. I wonder for LL if we should have check for meters as the unit, and report km instead if the distance is > 2500.0? (btw, note if you want bearing in lat/lon locations there will be two different bearings, a forward and backward one from each endpoint. (see the man page for geod))


in reply to:  2 comment:3 by hamish, 11 years ago

Replying to hamish:

I wonder for LL if we should have check for meters as the unit, and report km instead if the distance is > 2500.0?

ah, I see that MapFrame.FormatDist() already tries to do that, but it fails for LL as the fn is testing against the map units from projinfo (which says degrees) while the fn is being used with results from G_distance() which always returns meters.


comment:4 by voncasec, 11 years ago

Thanks for applying this fix to the wxGUI Display Hamish. I love being able to click a couple points on the map without having to think about the angle heading.


Note: See TracTickets for help on using tickets.