2

I have a coordinate in (lat/lon). I want to find a new coordinate shifted from this point by 'x' meters in the direction given by a compass bearing (degrees). The distance offset I am hoping to calculate will be fairly small, anywhere from 4-10 m, so I will need a fair amount of accuracy.

5
  • 2
    Your title and question don't quite tally, the title suggests moving a coordinate, the question is about find a new coordinate. What software or programming language are you using? If you were using QGIS you might find the Azimuth and Distance Plugin will do want you want ~ a new coordinate from an existing coordinate based on compass bearing, distance, and dip
    – nmtoken
    Commented Jun 21, 2019 at 18:49
  • 3
    What software are you using? Commented Jun 21, 2019 at 19:20
  • 2
    The formal name for this the Direct (or Forward) Geodetic Problem. Different software packages have different tools to address it, so you need to Edit the question to specify the software you are using.
    – Vince
    Commented Jun 21, 2019 at 19:23
  • Does this answer your question? Calculating Latitude/Longitude X miles from point?
    – whuber
    Commented Feb 1, 2021 at 20:43
  • Because the distance is so small, relative to the distance you can get by with rather poor accuracy. For instance, if your calculation is accurate only to four decimal places, the new coordinates will be correct to better than one millimeter (relative to the base coordinates, of course). The simple method I describe at gis.stackexchange.com/a/25883/664 will be more than good enough.
    – whuber
    Commented Feb 1, 2021 at 20:45

1 Answer 1

1

This is an interesting question.

The simplest approach is a numerical integration -- divide the path up into 10 meter segments, for example, and use a simple approximation for each point.

consider:

  1. the change in latitude is the sine of the heading (90 deg == north) times the distance times the conversion factor from distance to radians (π / 20000 km).
  2. calculate an average value of cosine over he interval. A simple approximation is the cosine of the average latitude.
  3. the change in longitude is the cosine of the heading (0 deg == east) times (π / 20000 km) divided by the cosine.
  4. check to make sure you didn't cross a pol (cosine of the latitude < 0). If you did, then it's an error. There's no such thing as heading north from the north pole.

Do capture the whole distance in one shot is extremely challenging mathematically, however, since consider a route heating 5 degrees north of east from 1 mm north of the south pole to 1 mm south of the north pole. It will be a spiral of increasing, then decreasing radius.

4
  • Actually geodesic functions capture the whole distance (short of antipodal distance, of course) quite easily. Iterative application of the Vincenty equations is part of every library that implements the Direct/Forward solution.
    – Vince
    Commented Feb 1, 2021 at 18:45
  • That's very interesting -- I looked up the iterative Vincenty equations on Wikipedia and they are fairly complex, and are still just an approximation. To test my very simple algorithm, I calculated the result of starting at (0, 0) and moving northeast for 10000 km. coordinates listed as latitude, longitude: 5000 points: 63.6396103067921 83.17349983439119: reference 1000 points: error = 1.4 meters 200 points: error = 37 meters 10 points: error = 14.7 km The error is inversely proportional to the square of the number of points. So it comes down to more iterations vs complexity. Commented Feb 1, 2021 at 19:21
  • The type of path that you calculate here is called a rhumb line (loxodrome), a path with constant bearing, which is very different from a geodesic. For the very small distances mentioned in the OP, and away from the poles, the difference should be negligible, but increases quickly when the distance gets longer. A 10,000 km loxodrome starting at (0,0) lands you in northern siberia, while a 10,000 km geodesic with the same start point and bearing will land you in China.
    – FSimardGIS
    Commented Feb 1, 2021 at 22:19
  • I was assuming "moving in the direction of a compass bearing" implied following a constant bearing (neglecting magnetic compass issues). You're right -- if you're going to find a geodesic instead (a "great circle route") then that's different, and is more easily solved. Commented Feb 2, 2021 at 19:12

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