2

Is there a known way of intentionally offsetting a latitude/longitude position by using a combination of the latitude/longitude and heading? I'm struggling to find any kind of answer or solution for this...

[Edit Partial Solution]

I came across this link which is what my code below is based on below which I think was a link within the Richard's link below.

As can be seen in the image below, I wanted to purposely introduce an offset which can be seen in the points highlighted in 'yellow' are offset by about 10 meters.

This does not hold true for some coordinates (i.e. I don't observe a consistent offset), which I am assuming depends on using the heading value, which I believe comes back to my original question, I believe use of the heading in a calculation is required.

I will continue my search and update if i I come across a solution for the next person.

#include <math.h>
#define EARTH_RADIUS (6378137.0)
void function(double lat_in, lon_in, double offset_mtr, double *lat_out, double *lon_out)
{
    double dLat = 0.0;
    double dLon = 0.0;
    if( (lat_out != NULL) && (lon_out != NULL) )
    {
        dLat = (offset_mtr/EARTH_RADIUS);
        dLon = (offset_mtr/(EARTH_RADIUS * cos(M_PI*lat_in/180)));

        (*lat_out) = lat_in + dLat * 180/M_PI;
        (*lon_out) = lon_in + dLon * 180/M_PI;
    }
}

Example

  • 2
    Support for recording GPS positions at an offset from the unit's actual location varies among GPS hardware. What kind of GPS unit are you using? Please add that to your question. Also, you would need an offset distance in addition to a heading. – Dan C Apr 25 '19 at 16:38
  • Any GIS software will have a tool for translating/offsetting points. Usually these tools take input in the form of X and Y offset distances. X and Y offset distances can be calculated from your heading and distance using sin() and cos() functions. – csk Apr 25 '19 at 17:32
  • Does this question help? gis.stackexchange.com/q/240071/43 This question also points to several other related questions. – Richard Morgan Apr 25 '19 at 17:36
  • Please clarify your question (read the valid comments) – Mapperz Apr 25 '19 at 20:27