Skip to content

Commit

Permalink
Fixed the issue with path lengths displaying as 0km, which was due to…
Browse files Browse the repository at this point in the history
… an off-by-one error with the flowline lengths
  • Loading branch information
sdl60660 committed Jan 17, 2022
1 parent 39108f6 commit b01af56
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/components/Map.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,13 @@
// currentFlowrateIndex = 0;
}
// Find the parent features of flowlines along the path
totalLength =
flowlinesData.features[0].properties.pathlength > 0
? flowlinesData.features[0].properties.pathlength
flowlinesData.features[0].properties.pathlength >= 0
? flowlinesData.features[0].properties.pathlength + flowlinesData.features[0].properties.lengthkm
: undefined;
// Find the parent features of flowlines along the path
const riverFeatures = getFeatureGroups(flowlinesData);
featureGroups = riverFeatures;
Expand Down Expand Up @@ -527,7 +528,7 @@
try {
const roundedLng = e.lngLat.lng.toFixed(roundingDigits);
const roundedLat = e.lngLat.lat.toFixed(roundingDigits);
const iowURL = `https://merit.internetofwater.app/processes/river-runner/execution?lng=${roundedLng}&lat=${roundedLat}&properties=comid,nameid,pathlength,levelpathi,streamlev,riverid,hydroseq`;
const iowURL = `https://merit.internetofwater.app/processes/river-runner/execution?lng=${roundedLng}&lat=${roundedLat}&properties=comid,nameid,pathlength,levelpathi,streamlev,riverid,hydroseq,lengthkm`;
const flowlinesResponse = await fetch(iowURL, {
method: "GET",
Expand Down Expand Up @@ -700,7 +701,7 @@
distance_from_destination:
featureData.properties.pathlength === -9999
? 0
: featureData.properties.pathlength,
: featureData.properties.pathlength + featureData.properties.lengthkm,
index,
stream_level: featureData.properties.streamlev,
active: false,
Expand Down

1 comment on commit b01af56

@vercel
Copy link

@vercel vercel bot commented on b01af56 Jan 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.