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

This commit is contained in:
csawatzky 2025-04-21 11:06:28 -06:00
parent 74c8ed661c
commit 022837de87
2 changed files with 5 additions and 5 deletions

View file

@ -499,7 +499,7 @@ export default function MapBase(props: Props) {
origin: pond.DataOrigin.DATA_ORIGIN_ADAPTIVE, origin: pond.DataOrigin.DATA_ORIGIN_ADAPTIVE,
totalDist: totalDist:
getDistanceUnit() === pond.DistanceUnit.DISTANCE_UNIT_METERS getDistanceUnit() === pond.DistanceUnit.DISTANCE_UNIT_METERS
? (data.totalDistanceKm / 1000).toFixed(2) ? (data.totalDistanceKm * 1000).toFixed(2)
: (data.totalDistanceKm * 3280.8398950131).toFixed(2) : (data.totalDistanceKm * 3280.8398950131).toFixed(2)
}; };
feats.push(newFeature); feats.push(newFeature);

View file

@ -1549,10 +1549,10 @@ import { Result } from "@mapbox/mapbox-gl-geocoder";
coords.forEach(pair => { coords.forEach(pair => {
currentPoint = pair; currentPoint = pair;
if (prevPoint.length === 2) { if (prevPoint.length === 2) {
let lat1 = prevPoint[0]; let long1 = prevPoint[0];
let long1 = prevPoint[1]; let lat1 = prevPoint[1];
let lat2 = currentPoint[0]; let long2 = currentPoint[0];
let long2 = currentPoint[1]; let lat2 = currentPoint[1];
let segmentLengthKm = coordDistance(lat1, long1, lat2, long2); let segmentLengthKm = coordDistance(lat1, long1, lat2, long2);
segmentsKm.push(segmentLengthKm); segmentsKm.push(segmentLengthKm);