Skip to content

Commit

Permalink
Fixed navigation grouping issue when identified inland features don't…
Browse files Browse the repository at this point in the history
… have a name associated with them in the data (replacing with 'Inland Water Feature')
  • Loading branch information
sdl60660 committed Dec 31, 2021
1 parent 7e2814b commit f020d6c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 0 additions & 4 deletions src/components/Map.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -738,10 +738,6 @@
(item, i, ar) => ar.indexOf(item) === i
);
console.log({ featureNames, uniqueFeatureNames });
const fullDistance = flowlinesData.features[0].properties.pathlength;
// This fixes a rare, but frustrating bug, where because I don't sample each flowline for VAA data, and because...
// I assume once a feature starts that it continues until the next unique feature, this function gets confused by...
// Long rivers sandwiching small unnames features, like the snake river in Idaho, and thinks that the small feature interruption
Expand Down
11 changes: 8 additions & 3 deletions src/components/utils/geoUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ const correctInterruptingLakes = (namedFlowlines) => {
let lastFeatureId = null;
let lastFeatureName = null;
let currentFeature = null;

// console.log('here1', namedFlowlines.map(d => d.properties.feature_id));

namedFlowlines.forEach((flowline, i) => {
const lastFlowline = namedFlowlines[i-1];
Expand All @@ -130,7 +132,9 @@ const correctInterruptingLakes = (namedFlowlines) => {
currentFeature = flowline.properties.feature_id;
flowline.properties.feature_id = lastFeatureId + '-copy';
}
})
});

// console.log('here2', namedFlowlines.map(d => d.properties.feature_id));

return namedFlowlines;
}
Expand Down Expand Up @@ -165,12 +169,13 @@ export const assignParentFeatureNames = (flowlines, nameOverrides, inlandFeature

inlandFeaturePolygons.forEach(inlandPolygon => {
const pointsWithin = pointsWithinPolygon(flowlineStartingPoints, inlandPolygon);
const featureName = inlandPolygon.properties.stop_feature_name === "" ? "Inland Water Feature" : inlandPolygon.properties.stop_feature_name;

pointsWithin.features.forEach(intersectingPoint => {
const correspondingFlowline = mappedFlowlines[intersectingPoint.properties.comid];

correspondingFlowline.properties.feature_name = inlandPolygon.properties.stop_feature_name;
correspondingFlowline.properties.feature_id = inlandPolygon.properties.stop_feature_name;
correspondingFlowline.properties.feature_name = featureName;
correspondingFlowline.properties.feature_id = featureName;
correspondingFlowline.properties.renamed_inland = true;
});
});
Expand Down

1 comment on commit f020d6c

@vercel
Copy link

@vercel vercel bot commented on f020d6c Dec 31, 2021

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.