I am plotting witness tree data to calculate pre-settlement tree density. I have a shapefile with points along section lines (square miles) at each half mile. I am making another table that contains tree data - distance, bearing, and diameter - related by survey point to the existing shapefile attribute table. Is there a way to create points on the map for the trees based on the distance and bearing from each survey point?

I'm not necessarily asking for a detailed set of instructions (although if anyone wishes to, I'd be grateful) but rather just if it's possible and a couple key words to continue searching how to do it.

  • 1
    You don't mention which version of QGIS you're using. If you are still on QGIS 1.8 there is an azimuth and distance plug-in which will do the job. It doesn't appear to be available for QGIS 2.0 yet sad to say. N.
    – nhopton
    Oct 31, 2013 at 19:46
  • 1
    There is an on-line calculator that might help: q-cogo.com
    – nhopton
    Oct 31, 2013 at 20:04
  • See also the Advanced Digitizing features explained in gis.stackexchange.com/a/142247/10229
    – Dave X
    Nov 15, 2020 at 15:16

3 Answers 3


It is pure trigonometry or vector calculus problem and you can get the result using polar coordinates (center of the figure) or the direction cosines (right) with 2D cartesian coordinates :

enter image description here

import math
point = (-1004.00, 635.00)
distance = 160
bearing =  103
angle =     90 - bearing
bearing = math.radians(bearing)
angle =   math.radians(angle)

# polar coordinates

dist_x, dist_y = \
    (distance * math.cos(angle), distance * math.sin(angle))
print dist_x, dist_y
#(155.89921036563763, -35.992168695018407)
xfinal, yfinal = (point[0] + dist_x, point[1] + dist_y)
print xfinal, yfinal
#(-848.1007896343624, 599.00783130498155)

# direction cosines

cosa = math.cos(angle)
cosb = math.cos(bearing)
xfinal, yfinal = \
    (point[0] +(distance * cosa), point[1]+(distance * cosb))
print xfinal, yfinal
#(-848.1007896343624, 599.00783130498155)


enter image description here

see also How to create points in a specified distance along the line in QGIS?

  • 1
    True, but it's misleading to state that "polar coordinates" and "direction cosines" as being different. The only difference -- which i corrected in your code -- is using sin(T) versus cos(pi/2-T).
    – Martin F
    Jun 12, 2014 at 4:26

I actually had to do something similar to this a couple of days ago. I found it easiest to do the calculations in Excel and then create an XY Events table in ArcGIS. I'm not familiar with QGIS but here is how you can do the calculations in Excel.

I'm assuming that there will be two columns in the spreadsheet with the following data

  • Column A: Compass Bearing in decimal degrees
  • Column B: Distance from base point in metres

You will then need to create two calculated columns (note these formalae are in Excel format)

  • Column C: =SIN(RADIANS( [Column A]))*[Column B]
  • Column D: =COS(RADIANS([Column A]))*[Column B]

Column C will contain the X displacement in metres from your base point and Column D will contain the Y displacement in metres from your base point. If you add the value in Column C to the X coordinate of your base point and the value in Column D to the Y coordinate of your base point you will have the coordinate of the tree.

  • 1
    The formulae seem to have got swapped... Should be: Column C: =SIN(RADIANS( [Column A]))*[Column B] and Column D: =COS(RADIANS([Column A]))*[Column B]
    – Kanchu
    Sep 14, 2016 at 14:18
  • Worked perfectly. Did this in Python like this gdf['C'] = np.sin(np.deg2rad(gdf['A']))*gdf['B']
    – g123456k
    May 12 at 7:55

So you have a survey point with x,y (and z?) coordinates, and information like "tree 1 is at 227° bearing, 12m distance. tree 2 is at 26° bearing, 200m distance"? This will then be a trigonometry problem, calculating the actual tree position in x,y coordinates. So i would first convert my coordinates to cartesian coordinates (e.g. UTM), then it becomes a simple problem of trigonometry to calculate each trees position. This could the be done e.g. with python, or you could create a table in e.g. excel or openCalc and then join that to your shapefile (by tree id or sth.)

  • 1
    Hi,Yes that's it exactly. It's Florida so the Z component is trivial, and the distances are typically less than 300 meters. Converting to UTM and writing a trig function was my "plan B" if there wasn't an easier way. I might give it a try first in python - might be a good way to learn it a little better. If I need to I can use R. Thanks!
    – Tim
    Oct 31, 2013 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.