If you haven’t read Part 1 of this blog post, check it out here

 

I recently worked on a client project where I converted latitude and longitude (GPS coordinates) into a customised coordinate system. The new coordinates must reflect distances and direction relative to a series of origin points. As shown in the featured image above, instead of a line path relative to North on a map, we want to visualise the path from a “first person” perspective at an origin point. In other words, the frame of reference is relative to the origin point. In this blog, I will describe challenges of a dynamic frame of reference when implementing the workflow I introduced in an earlier blog. A link to my previous blog post is here.

 

Orientation of Origin Point

To start, I want to figure out the orientation of the origin point. Usually, this is determined by the first 2 rows of data (i.e. the direction of the line that connects the first 2 points). However, sometimes this can also be done relative to an external origin point. In either case, I would first try to find the adjustments necessary to change the frame of reference. A simple workflow to find this is shown below:

 

reconstruct coordinates in different frames of reference

 

I have used the Make Column tool here to do a quick Cross Tab of the 2 initial rows. This works by re-ordering the rows by their position and populating cells from left to right. More information on this tool can be found here. The Distance tool is used to calculate the direction (in degrees relative to North) that will be used to adjust subsequent points in the data. Visually, the angle can be represented as shown below:

 

 

 

Adjusting for Frame of Reference

Using the calculated angle from before, I can now append this to each row of the data. I am assuming at this stage, that each row of data has a direction field (in degrees) relative to the origin point. The difference in this direction field and the calculate angle from before will tell you how much “adjustments” are needed. I have called this my “Modified Angle” in my calculations. Depending on the data set, you need to use slightly different formulas to calculate X and Y “coordinates” or distances away from the origin. I used a Filter tool as shown below to split the data stream so that I can apply separate formulas for each:

 

reconstruct coordinates in different frames of reference

 

The Filter tool separates out Modified Angles that are positive to stream #1 above, whereas stream #2 contains negative Modified Angles. In stream #1, the formula (Formula 1) to calculate X and Y coordinates are:

 

reconstruct coordinates in different frames of reference

 

In contrast, Formula 2 for stream #2 is:

 

reconstruct coordinates in different frames of reference

 

Note that I have used the same X/Y Distance field name in both cases. This is so that I can easily union the data based on field name. After these set of calculations, I can now visualise from a “first person” view rather than a top down view.

 

Reconstructed Coordinates in a Different Frame of Reference

 

I used Tableau to visualise the X and Y “coordinates” that I just created. Essentially, from the perspective of someone walking this path towards Sydney Opera House, I can now visualise the path in distance and direction relative to the origin point.

 

In summary, I have discussed reconstructing coordinates in different frames of reference based on a dynamic origin point. My earlier blog post also presented a general guide to convert latitude and longitude into distances from an origin point. Trying to make this content more easily understood had been challenging. However, I hope you have found this useful.

 

 

 

Photo by C.Valdez on Unsplash

Alex Chan
Author: Alex Chan