26 lines
727 B
JavaScript
26 lines
727 B
JavaScript
import utmObj from "utm-latlng";
|
|
|
|
const utm = new utmObj();
|
|
|
|
/**
|
|
* @module toLatLon
|
|
*/
|
|
|
|
/** Converts UTM coordinates in database store records to latitude/longitude for use with the map
|
|
* @param {number} easting - UTM easting of store
|
|
* @param {number} northing - UTM northing of store
|
|
* @param {string} zone - UTM zone of store
|
|
* @param {string} zoneLetter - UTM zone letter of store
|
|
* @returns {Array} - Array of coordinates as [latitude, longitude]
|
|
*/
|
|
const toLatLon = (easting, northing, zone, zoneLetter) => {
|
|
const convertedCoordinates = utm.convertUtmToLatLng(
|
|
easting,
|
|
northing,
|
|
zone,
|
|
zoneLetter
|
|
);
|
|
return [convertedCoordinates.lat, convertedCoordinates.lng];
|
|
};
|
|
|
|
export default toLatLon;
|