2

I have an Excel file with the following data:

1) longitude and latitude which represents a point
2) Angle which represents where line turns from North
3) length of line.

Is is possible to draw these lines in bulk?

Note : I know how to create these lines individually using a tool, but not in bulk.

3

What you need to do is create a list of points, then using the following algorithm, and Dist and heading, calculate the point 1

Something I dug out from Lat/Long heading and dist This is a cracking site which I use from time to time.

Lat/lon given radial and distance A point {lat,lon} is a distance d out on the tc radial from point 1 if:

 lat=asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc))
 IF (cos(lat)=0)
    lon=lon1      // endpoint a pole
 ELSE
    lon=mod(lon1-asin(sin(tc)*sin(d)/cos(lat))+pi,2*pi)-pi
 ENDIF

This algorithm is limited to distances such that dlon < pi/2, i.e those that extend around less than one quarter of the circumference of the earth in longitude. A completely general, but more complicated algorithm is necessary if greater distances are allowed:

 lat =asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc))
 dlon=atan2(sin(tc)*sin(d)*cos(lat1),cos(d)-sin(lat1)*sin(lat))
 lon=mod( lon1-dlon +pi,2*pi )-pi

Also, a note I found from the author regarding using mod:

From my "implementation notes":

Note on the mod function. This appears to be implemented differently in different languages, with differing conventions on whether the sign of the result follows the sign of the divisor or the dividend. (We want the sign to follow the divisor or be Euclidean. C's fmod and Java's % do not work.) In this document, Mod(y,x) is the remainder on dividing y by x and always lies in the range 0 <= mod < x. For instance: mod(2.3,2.)=0.3 and mod(-2.3,2.)=1.7

If you have a floor function (int in Excel), that returns floor(x)= "largest integer less than or equal to x" e.g. floor(-2.3)=-3 and floor(2.3) =2

  • 1
    +1 Good answer. To the implementation notes you should add that (1) all angles are in radians, not degrees (which is fairly obvious but is worth mentioning for those less familiar with trigonometry); (2) even distances on the earth (d) are in degrees. They will have to be converted from meters (or whatever). (3) The bearing used here is west of north, not the usual east of north! – whuber Aug 16 '11 at 15:34
  • @whuber +1 too for the comment – kinkajou Aug 16 '11 at 22:36

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.