Skip to content

Commit b01af56

Browse files
committed
Fixed the issue with path lengths displaying as 0km, which was due to an off-by-one error with the flowline lengths
1 parent 39108f6 commit b01af56

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/components/Map.svelte

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,13 @@
284284
// currentFlowrateIndex = 0;
285285
}
286286
287-
// Find the parent features of flowlines along the path
287+
288288
totalLength =
289-
flowlinesData.features[0].properties.pathlength > 0
290-
? flowlinesData.features[0].properties.pathlength
289+
flowlinesData.features[0].properties.pathlength >= 0
290+
? flowlinesData.features[0].properties.pathlength + flowlinesData.features[0].properties.lengthkm
291291
: undefined;
292292
293+
// Find the parent features of flowlines along the path
293294
const riverFeatures = getFeatureGroups(flowlinesData);
294295
featureGroups = riverFeatures;
295296
@@ -527,7 +528,7 @@
527528
try {
528529
const roundedLng = e.lngLat.lng.toFixed(roundingDigits);
529530
const roundedLat = e.lngLat.lat.toFixed(roundingDigits);
530-
const iowURL = `https://merit.internetofwater.app/processes/river-runner/execution?lng=${roundedLng}&lat=${roundedLat}&properties=comid,nameid,pathlength,levelpathi,streamlev,riverid,hydroseq`;
531+
const iowURL = `https://merit.internetofwater.app/processes/river-runner/execution?lng=${roundedLng}&lat=${roundedLat}&properties=comid,nameid,pathlength,levelpathi,streamlev,riverid,hydroseq,lengthkm`;
531532
532533
const flowlinesResponse = await fetch(iowURL, {
533534
method: "GET",
@@ -700,7 +701,7 @@
700701
distance_from_destination:
701702
featureData.properties.pathlength === -9999
702703
? 0
703-
: featureData.properties.pathlength,
704+
: featureData.properties.pathlength + featureData.properties.lengthkm,
704705
index,
705706
stream_level: featureData.properties.streamlev,
706707
active: false,

0 commit comments

Comments
 (0)