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

closed as unclear what you're asking by Spacedman, whyzar, Dan C, Mapperz Apr 25 at 20:26

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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 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 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 at 17:36
  • Please clarify your question (read the valid comments) – Mapperz Apr 25 at 20:27