Earlier this year we launched calculation fields, and we’re constantly impressed with the ways our customers are using them to add value to their field surveys. I want to demo a neat technique you can use to embed proj4js into a calculation field to gain access to custom GIS projections.
First, I’ll just show you the result:
The idea in the demo is pretty simple. The app uses the LATITUDE() and LONGITUDE() functions to display and store the record location using different projections in separate calculation fields. In the demo app, the projection can also be changed on the fly using a choice field. Here is a table of the projections used in the demo app:
EPSG CodeProj.4 TextEPSG:4326 WGS 84+proj=longlat +datum=WGS84 +no_defsEPSG:3086 NAD83 / Florida GDL Albers+proj=aea +lat_1=24 +lat_2=31.5 +lat_0=24 +lon_0=-84 +x_0=400000 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defsEPSG:3857 Spherical Mercator+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defsEPSG:3031 Antarctic Polar Stereographic (just for fun)+proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defsEPSG:26917 UTM zone 17N+proj=utm +zone=17 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
Here is the source of the “Proj4js” calculation field that exports a proj4 function we can use in other calculation fields.
Try it Yourself
Here is a link to the demo app in the app gallery. You can add it to your account to try it out yourself.