RTK to WGS84

Transforming Coordinates with JavaScript using proj4.js

In my day job we recently completed a project to field locate our water utility assets using a high-accuracy GPS unit. Now that this data is online and accessible in our web maps, our field crews requested a method to locate these assets again using GPS if need be, for instance if there is a foot of snow on the ground.

On the surface, the solution to this seems straightforward: load a CORS-corrected GPS position into a web map and track this location against the known location of the field asset. However, the real-time corrections coming from the CORS base station are in NAD83, while the mapbox-powered web map uses the WGS84 datum. This means that using the CORS-corrected coordinates directly will lead to a ~3ft shift compared to the asset location. In order for these positions to line up, the GPS position needs to have a geographic transformation applied. In this example I am using the proj4.js library.

Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations. Originally a port of PROJ.4 and GCTCP C it is a part of the MetaCRS group of projects. ~ proj4.js

The default transformation between WGS84 and NAD83 in proj4 is null, so first we need to define a custom transformation. The transformation in this example (known as the ITRF00 transformation) came from ArcGIS Desktop 10.7. With guidance from this post on Stack Exchange, I adjusted the parameters so that the transformation will work with proj4. Note that the definition does not add the +datum=NAD83 option, as the NAD83 proj4 definition will override the custom transformation.

var towgs84 = "-0.9956,1.9013,0.5215,0.025915,0.009246,0.011599,-0.00062"

var nad83ITRF00 = '+proj=longLat +ellps=GRS80 +towgs84=' + towgs84 + ' +units=degrees +no_defs'

var nad83NoTransform = '+proj=longLat +ellps=GRS80 +towgs84=0,0,0 +units=degrees +no_defs'

Now that the GPS position is transformed, the targeting function in our web map can bring the field crews to within double the margin of error for the GPS unit. Once they reach the target on the web map, the field crews can use metal detectors or ground probes to physically locate the asset.

Decimal Degrees from ArcGIS while in NAD83 Projection

var nad83 = [-82.007084,39.941774]

proj4 Output to NAD83 (default)

var wgs84toNAD83 = [-1.4312936257595616,0.6971154653874656]

proj4 Output from NAD83 back to WGS84 with ITRF00 Transformation

var transformedToWGS84 = [-82.007088,39.941782]

Decimal Degrees from ArcGIS while in WGS84 Projection with ITRF00 Transformation

const xy = [-82.007088, 39.941782]

Final Function

function coordRTKtoWGS84 (point) {
var nad83ITRF00 = "+proj=longLat +ellps=GRS80 +towgs84=-0.9956,1.9013,0.5215,0.025915,0.009246,0.011599,-0.00062 +units=degrees +no_defs";

var nad83NoTransform = "+proj=longLat +ellps=GRS80 +towgs84=0,0,0 +units=degrees +no_defs";

var pointInNAD83 = proj4(nad83NoTransform,point);

return proj4(nad83ITRF00, 'WGS84', pointInNAD83)
Newer Post
Ohio COVID-19 Dashboard
Older Post
Highlighting Features in Mapbox GL JS

Related Posts