November 16, 2021

# When to create a Best Fit System in Geographic Calculator

The new version of Geographic Calculator includes numerous updates to the latest geodetics trends, such as increased flexibility and new methods for time-based coordinate systems, brand new geoid models, and a new connection to the latest version of the revamped EPSG online dataset hosted by the IOGP.  Among these cutting edge tools lies an often overlooked, yet indispensable feature of the Geographic Calculator: The Best Fit operation.  When you need it, you need it, and there is no substitute. The use case for the best fit operation spans industries and is actually fairly simple; when a user has data in a completely unknown coordinate system based on a non-geodetic ground reference and arbitrary location, and it needs to be aligned with data relative to a coordinate system based on a geodetic datum, such as latitude/longitude or projection based system, a Best Fit job should be used.

The best fit process establishes a simple mathematical transformation to align the unknown local system with a known system so that the data in the local coordinate system is able to be transformed back and forth with any other geodetically based system. These are very common in industries such as traditional land surveying, mining, construction, natural resources extraction, and airport management. In all of these areas, work tends to be focused on a very specific area on the ground, and the larger need for a globally aware reference system was often secondary, particularly in the days before GPS. In some industries such as airport management and mining, the need for extreme accuracy and precision outweighs the utility of the global reference.

Historically, coordinate systems based on these local areas have been managed with traditional land surveying techniques. With modern GPS technology, the utility of a globally aware coordinate system in which GPS can be utilized is greatly increased, so the need to bring these two types of coordinate systems together becomes obvious. Geodetics is perpetually in a period of transition where the latest technology is fused with sometimes very old reference systems, bringing the past into the present.

## The Math

The mathematics involved in the best fit process are actually exactly the same as in the traditional georeferencing process that one might use to add control points to a scanned raster image. The use of polynomial equations is most commonly applied. Specifically, many local coordinate systems occupy a small enough area that a simple linear transformation can be calculated. By far the most common equation used is the affine, which is a linear equation handling scale, rotation, and skew of the two X and Y coordinate axes. If you recall basic algebra, the formula for an affine resembles the equation for the slope of a line:  y=mx+b.  Except in this context, the mathematics results in two of those equations, one representing the transformation for y and one representing the transformation for x. For local areas up to about 10 miles, an affine transformation performs quite well and stays within what is considered acceptable accuracy for survey purposes. Beyond that, the linear nature of the formula tends to break down due to the curvature of the earth and requires more control points and higher-order polynomial equations. For very large areas up to whole countries, there are transformations of this type that go all the way up to 5th order polynomials; that’s a lot of variables and control data required!

## The Process

The good news about the Point Database Best Fit operation in Geographic Calculator is that you don’t actually have to do the math yourself. With high-quality control data, a user of the Geographic Calculator is able to derive this transformation in a matter of minutes. Most of the work to bring these two types of coordinate systems together starts well before loading data into the calculator. The required input is two sets of control points; one in the local ground system and one in the geodetically based coordinate system that will be used as the reference. The process within Geographic Calculator simply involves loading the spreadsheet, applying the settings identifying each column, and then assessing the values of the residual errors that are calculated. The real work is in assembling the control points.

If the local ground control points have not been surveyed against a geodetic datum, the best fit process begins with true fieldwork to establish a high-quality Ground Control point in both coordinate systems. The minimum required points to satisfy an affine equation is only three; however, it is much more common practice to use somewhere between 10 and 30 control points. More control points can be used; however, going much beyond 30 for a localized area ends up with diminishing returns for the effort required in the field. The main qualifiers for the control points are high accuracy, high precision, and even distribution throughout the area. It is entirely possible to bias the transformation if proper care is not taken in the collection of the points. Making sure that points are recorded throughout the entire boundary of the area as well as towards the middle is key in reducing bias.  The quality of the generated fit relies on having good fieldwork to feed into the tool. Residual error assessment is a part of the process that is plotting and evaluating errors to reduce the overall error known as Root Mean Square Error (RMSE). A graphical plot is a simple way to quickly see those error vectors and helps with the iterative process of improving the fit.

## Alternative Methods

Historically, there have been other ways to connect an unknown grid with known coordinate reference systems. A simpler transformation is sometimes referred to as a “two-point fit” or simply “scale and rotate.” The trouble with a two-point fit is that while it may accurately align specifically between the two control points, it does not spread well across the second dimension throughout wider areas. This results in inaccurate scaling, and we simply have the technology with modern equipment to do better than this and maintain survey level accuracy.

Another method for handling these systems is to iteratively derive a “projection” that approximates the coordinates. This is a more common alternative as more GIS users have become aware of the idea of the “Low Distortion Projections,” which are seeing increased usage in the surveying world. This might be a simple orthographic projection based on a center point and scale or a more complex transverse or oblique Mercator. This method allows a user to pretend that the local ground coordinates are actually in a projected system and thus work with them directly in a geodetically aware GIS system since most modern GIS systems can handle customized projections. The setup of this type of coordinate system takes time and skill to massage the values used in the projection to get the centering, rotation, and scaling correct, along with assessing the errors, making changes, and so on through the iterations. The end result can be satisfactory for some purposes, but getting to the survey level of accuracy can be a time-consuming challenge. It also does not reduce the fieldwork necessary to qualify the accuracy of the transformation.

Time and time again, customers contact us to learn about what is involved with these methods and end up very happily using Geographic Calculator’s polynomial best fit in the end due to the simplicity of the setup, as well as the accuracy of the output.

## Wrap up

Working with any new process can be a challenge, and setting up a Best Fit system is no different. Once someone has set up their first transformation, we often hear that it was easier than they thought it would be for the accuracy it is capable of.  One of our customers once shared that “when you’re letting a million-dollar robot drive itself around an open-pit mine, you want to be sure it’s driving in the right place and not off a cliff.” It’s often well worth the time spent getting up to speed and creating these transformations where they can be used. A little guidance is usually needed and the technical support team here at Blue Marble is ready to help. Once the transformation is set up, it’s permanently a part of your Geographic Calculator database and can be used to convert data back and forth as needed. The most common thing we hear back from new users of a Best Fit is that they are amazed how much time it will save them managing their local data.

When transformations have to be correct, consistent, and certifiable, GIS professionals around the world choose Geographic Calculator. Learn more about Geographic Calculator and request a 7-day trial today!

If you enjoyed this blog, you may also find these other resources useful:

Ask the Experts: Exploring the Best Fit Job in Geographic Calculator

Introducing Geographic Calculator