How to convert Distance, Azimuth, Dip to XYZ?

The question asks for conversion between spherical and cartesian coordinates. This spreadsheet lays out the formulas:

Spreadsheet screen shot

Blue lines are input, black are intermediate calculations, and red are output. Within the formulas, the values are referred to by the names in the [Parameter] column (assigned via the Insert|Name|Create operation).

They differ from those in most math/physics references because in geography, the azimuth is usually taken east of north rather than north of east. This makes the geographic azimuth the complement of the mathematical one (they sum to 90 degrees). Replacing an angle by its complement in any trig function interchanges it with its "co" partner: sine and cosine are interchanged, tangent and cotangent, secant and cosecant. Also, in many mathematical systems the "dip" is expressed as an angle from true vertical (a co-latitude) rather than as an angle from horizontal (a latitude), again causing an interchange of sine and cosine.

Edit 9/20/13

For a downhole distance you probably want to negate dZ.


While this is an old question, the other answers are not appropriate. Converting Distance (Measured Depth), Dip (Inclination), Azimuth to 3D coordinates depends on how you interpret what is happening between the locations where measurements were taken (survey stations). The standard practice today is "Minimum Curvature" where the assumption is that a circular arc connects each survey location.

http://www.drillingformulas.com/minimum-curvature-method/ gives full details on how to calculate the X, Y and Z locations. The relevant portions are:

dMD = Distance2 - Distance1
B = acos(cos(I2 - I1) - (sin(I1)*sin(I2)*(1-cos(A2-A1))))
RF = 2 / B * tan(B / 2)
dX = dMD/2 * (sin(I1)*sin(A1) + sin(I2)*sin(A2))*RF
dY = dMD/2 * (sin(I1)*cos(A1) + sin(I2)*cos(A2))*RF
dZ = dMD/2 * (cos(I1) + cos(I2))*RF

X2 = X1 + dX
Y2 = Y1 + dX
Z2 = Z1 + dX