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elivr using Terser v5.39.0.\n * Original file: /npm/@geospatial/data-waypoints@19.7.1/lib/index.cjs.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar turf = require('@turf/turf');\nvar fp = require('lodash/fp');\nvar mathjs = require('mathjs');\n\n/**\n*    Returns the exact \"air\" distance in metres between two WGS84 locations.\n*    Does not consider the altitude\n    http://www.movable-type.co.uk/scripts/latlong.html\n*/\n\nfunction getDistanceMetres(location1, location2) {\n  const R = 6378137.0; // Radius of \"spherical\" earth\n\n  const lat1 = location1[0] * Math.PI / 180;\n  const lon1 = location1[1] * Math.PI / 180;\n  const lat2 = location2[0] * Math.PI / 180;\n  const lon2 = location2[1] * Math.PI / 180;\n  const dlat = lat2 - lat1;\n  const dlon = lon2 - lon1;\n  const a = Math.sin(dlat / 2) * Math.sin(dlat / 2) + Math.cos(lat1) * Math.cos(lat2) * Math.sin(dlon / 2) * Math.sin(dlon / 2);\n  const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n  const d = R * c;\n  return d;\n}\n/**\n*    Returns the exact \"air\" distance in metres between two WGS84 locations.\n*   Consider the altitude\n    http://www.movable-type.co.uk/scripts/latlong.html\n*/\n\nfunction getDistanceMetres3D(location1, location2) {\n  const twoDimensionalDistance = getDistanceMetres(convertLocationDictToSterblueList(location1), convertLocationDictToSterblueList(location2));\n  return Math.sqrt(Math.pow(twoDimensionalDistance, 2) + Math.pow(location1.altitude - location2.altitude, 2));\n}\nfunction getDistanceMetresLTP3D(location1, location2) {\n  return mathjs.norm(fp.map(index => location2[index] - location1[index], fp.range(0, location1.length)));\n}\n\n/**\n * @module utils/convert/waypoints\n */\n/**\n *    Returns the exact \"air\" distance in metres between two WGS84 locations.\n *    Does not consider the altitude\n *    http://www.movable-type.co.uk/scripts/latlong.html\n *    Inputs and output are dict\n */\n\nfunction getDistanceMetresDict(location1, location2) {\n  return getDistanceMetres(convertLocationDictToSterblueList(location1), convertLocationDictToSterblueList(location2));\n}\nfunction convertLocationDictToSterblueList(dict) {\n  const sterblueList = [dict.latitude, dict.longitude, dict.altitude];\n  return sterblueList;\n}\nfunction convertLocationDictToGeojsonList(dict) {\n  const geoJsonList = [dict.longitude, dict.latitude, dict.altitude];\n  return geoJsonList;\n}\nfunction convertLocationDictToPoint(dict) {\n  const geoJsonPoint = turf.point([dict.longitude, dict.latitude, dict.altitude]);\n  return geoJsonPoint;\n}\nfunction convertPointToDict(point) {\n  const dict = {\n    latitude: point.geometry.coordinates[1],\n    longitude: point.geometry.coordinates[0],\n    altitude: point.geometry.coordinates[2]\n  };\n  return dict;\n}\nfunction convertPointToGeoJsonList(point) {\n  const geoJsonList = point.geometry.coordinates;\n  return geoJsonList;\n}\nfunction convertPointToSterblueList(point) {\n  const sterblueList = [point.geometry.coordinates[1], point.geometry.coordinates[0], point.geometry.coordinates[2]];\n  return sterblueList;\n}\nfunction convertSterblueListToDict(sterblueList) {\n  const dict = {\n    latitude: sterblueList[0],\n    longitude: sterblueList[1],\n    altitude: sterblueList[2]\n  };\n  return dict;\n}\nfunction convertSterblueListToGeoJsonList(sterblueList) {\n  const geoJsonList = [sterblueList[1], sterblueList[0], sterblueList[2]];\n  return geoJsonList;\n}\nfunction convertSterblueListToPoint(sterblueList) {\n  const geoJsonPoint = turf.point([sterblueList[1], sterblueList[0], sterblueList[2]]);\n  return geoJsonPoint;\n}\nfunction convertGeoJsonListToPoint(geoJsonList) {\n  const geoJsonPoint = turf.point(geoJsonList);\n  return geoJsonPoint;\n}\nfunction convertGeoJsonListToDict(geoJsonList) {\n  const dict = {\n    latitude: geoJsonList[1],\n    longitude: geoJsonList[0],\n    altitude: geoJsonList[2]\n  };\n  return dict;\n}\nfunction convertGeoJsonListToSterblueList(geoJsonList) {\n  const sterblueList = [geoJsonList[1], geoJsonList[0], geoJsonList[2]];\n  return sterblueList;\n}\n\nexports.convertGeoJsonListToDict = convertGeoJsonListToDict;\nexports.convertGeoJsonListToPoint = convertGeoJsonListToPoint;\nexports.convertGeoJsonListToSterblueList = convertGeoJsonListToSterblueList;\nexports.convertLocationDictToGeojsonList = convertLocationDictToGeojsonList;\nexports.convertLocationDictToPoint = convertLocationDictToPoint;\nexports.convertLocationDictToSterblueList = convertLocationDictToSterblueList;\nexports.convertPointToDict = convertPointToDict;\nexports.convertPointToGeoJsonList = convertPointToGeoJsonList;\nexports.convertPointToSterblueList = convertPointToSterblueList;\nexports.convertSterblueListToDict = convertSterblueListToDict;\nexports.convertSterblueListToGeoJsonList = convertSterblueListToGeoJsonList;\nexports.convertSterblueListToPoint = convertSterblueListToPoint;\nexports.getDistanceMetres = getDistanceMetres;\nexports.getDistanceMetres3D = getDistanceMetres3D;\nexports.getDistanceMetresDict = getDistanceMetresDict;\nexports.getDistanceMetresLTP3D = getDistanceMetresLTP3D;\n"]}