We posted a while back about a technique for capturing and converting coordinate systems on-demand using calculation fields. That method used the excellent proj4js library to take given latitude / longitude pairs for a Fulcrum record, and calculated the correct values for the projection of choice. This post gives a quick similar method for doing the same thing, but for the popular UTM coordinate system (Universal Transverse Mercator).
UTM is a common coordinate system that works by dividing the Earth into “zones”, with positions referenced as “northing” and “easting” from the grid cell boundaries. Its legacy lies in print maps, where surveyors (or soldiers) needed easier means for measuring distances between points in the field. UTM made wayfinding much simpler and provided an easier means to train people in map navigation. It also made it easier to communicate precise coordinates. (See our previous post comparing the pros and cons of different coordinate systems.)
Calculating UTM automatically
For any records in Fulcrum, you can copy and paste this code into a calculation field expression to convert the record’s latitude and longitude to UTM format. Set the output of the field to “Text” and you’ll get a field in your app that auto-populates with the record’s UTM coordinates. It uses the built in LATITUDE() and LONGITUDE() functions in Fulcrum to perform the calculation:
Here’s the final product in action from the mobile app. Any time the record’s position changes, the UTM field will recalculate on-the-fly to give you the zone, northing, and easting as text.
The code within this sample was adapted from the node-coordinator project on GitHub. Using this same code, you can also swap out the final line with SETRESULT(mgrsRef.toString()); and output MGRS coordinates instead of UTM (since the math for calculating that is similar). Be sure to check out our documentation on calculation fields to get other ideas on using them for novel automation applications like this one.