-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a "flatten" option to the new FeatureInfo #1056
Comments
I tested the following implementation: // new-client/src/components/MapClickViewer/views/FeatureCollectionsListView.js
const [flatten, setFlatten] = useState(false);
const [flatCollection, setFlatCollection] = useState([]);
const toggleFlatten = () => {
if (flatten === false) {
// Flatten features
const features = featureCollections.flatMap((fc) => fc.features);
setFlatCollection([
{
displayFields: [],
displayName: "Samlade resultat",
features: features,
infoClickDefinition: "",
infoclickIcon: "",
layerId: "flattened_layer.0",
numHits: features.length,
secondaryLabelFields: [],
shortDisplayFields: [],
type: "GetFeatureInfoResults",
},
]);
setFlatten(true);
} else {
// Un-flat
setFlatCollection([]);
setFlatten(false);
}
};
const fcs = flatCollection.length > 0 ? flatCollection : featureCollections; This won't work, as the made-up Hajk/new-client/src/components/MapClickViewer/MapClickViewerView.js Lines 34 to 37 in 49e8340
We have a couple of alternatives here.
I'm pausing this for now as other stuff are more important to focus on currently. Leaving you with this sum-up. |
We looked at this issue and have some thoughts we would like to discuss with you if you have some time @jacobwod? |
As we talked about, we support this proposal and preferably according to the original design sketch. The user case that formed the basis of the design: The design sketch below has a little more text than the original to more clearly describe the different parts. |
While #1034 solves the general problem as suggested, there might by occasions where it would be more preferable to see the returned features as a flat list, rather than grouped by category. Here's one such example. One could argue that browsing these results would be easier if the collection was flat:
![Skärmavbild 2022-04-11 kl 08 51 07](https://user-images.githubusercontent.com/110222/162681144-a5f70e0b-ce80-4b00-b741-b293af24bbeb.png)
The text was updated successfully, but these errors were encountered: