Consulting

Results 1 to 6 of 6

Thread: Excel coordinate projection - distance and bearing

  1. #1
    VBAX Tutor
    Joined
    Mar 2010
    Posts
    287
    Location

    Question Excel coordinate projection - distance and bearing

    Hello - I am hoping for some assistance with what I hope is a simple problem. The terminology I use may be incorrect so please feel free to correct.

    Given an origin of X1 and Y1, I would like to project a given distance and bearing and then calculate the resulting X2 and Y2. Distances would be in metres and bearing would be in degrees, treating north as zero. I have been experimenting with the following but cannot get it to work:

    X2=X1+[cos(angle)*Distance]
    Y2=Y1+[sin(angle)*Distance]

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,872
    try:
    X2=X1+SIN(degrees*PI()/180)*distance
    and:
    Y2=Y1+COS(degrees*PI()/180)*distance
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,724
    Location
    Done with WS formulas and named ranges (so I wouldn't get confused)


    Capture.JPG

    The attachment does 0-360 and negative angles seem to work (but my math skills are fuzzy after all these years)

    The bearing is measured in degrees east or west of north (so 0 = due north, -90 or 270 are due west, etc.)
    Attached Files Attached Files
    Last edited by Paul_Hossler; 07-29-2017 at 06:32 AM. Reason: Forgot the minus sign on -90
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  4. #4
    VBAX Tutor
    Joined
    Mar 2010
    Posts
    287
    Location
    This problem has been delaying me in my work for some time! I now have a workable solution. I am combining this (final formula) with other trig to calculate distance, bearing etc.

    This has been very helpful. Thank you for your assistance!

  5. #5
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,724
    Location
    Don't forget to mark it [Solved] using [Thread Tools] above your first post
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  6. #6
    VBAX Tutor
    Joined
    Mar 2010
    Posts
    287
    Location
    Quote Originally Posted by Paul_Hossler View Post
    Don't forget to mark it [Solved] using [Thread Tools] above your first post
    This is the attached file, with a graph to show the effect I was hoping to achieve.

    Excel Trig Project Coordinate.xlsx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •