From 022837de8761eec0265d997c14a0904c4192093a Mon Sep 17 00:00:00 2001 From: csawatzky Date: Mon, 21 Apr 2025 11:06:28 -0600 Subject: [PATCH] fixing map line, conversion from km to m was wrong, and the lat and long for the coordinates were backwards causing the distances to behave erratically --- src/maps/MapBase.tsx | 2 +- src/maps/mapObjectControllers/AgMapController.tsx | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/maps/MapBase.tsx b/src/maps/MapBase.tsx index d0224e6..911b462 100644 --- a/src/maps/MapBase.tsx +++ b/src/maps/MapBase.tsx @@ -499,7 +499,7 @@ export default function MapBase(props: Props) { origin: pond.DataOrigin.DATA_ORIGIN_ADAPTIVE, totalDist: getDistanceUnit() === pond.DistanceUnit.DISTANCE_UNIT_METERS - ? (data.totalDistanceKm / 1000).toFixed(2) + ? (data.totalDistanceKm * 1000).toFixed(2) : (data.totalDistanceKm * 3280.8398950131).toFixed(2) }; feats.push(newFeature); diff --git a/src/maps/mapObjectControllers/AgMapController.tsx b/src/maps/mapObjectControllers/AgMapController.tsx index 57fea0a..a326d33 100644 --- a/src/maps/mapObjectControllers/AgMapController.tsx +++ b/src/maps/mapObjectControllers/AgMapController.tsx @@ -1549,10 +1549,10 @@ import { Result } from "@mapbox/mapbox-gl-geocoder"; coords.forEach(pair => { currentPoint = pair; if (prevPoint.length === 2) { - let lat1 = prevPoint[0]; - let long1 = prevPoint[1]; - let lat2 = currentPoint[0]; - let long2 = currentPoint[1]; + let long1 = prevPoint[0]; + let lat1 = prevPoint[1]; + let long2 = currentPoint[0]; + let lat2 = currentPoint[1]; let segmentLengthKm = coordDistance(lat1, long1, lat2, long2); segmentsKm.push(segmentLengthKm);