Filter our multiple occurrences of OSM features in <Infos>
This commit is contained in:
parent
b9d886db69
commit
3daa2d11f9
|
@ -55,9 +55,18 @@ export const clickHandler = (event: any) => {
|
|||
}
|
||||
});
|
||||
selectedFeatures = features.filter((feature: any) => feature.get('context'));
|
||||
vectorLayerFeatures = features.filter(
|
||||
(feature: any) => !feature.get('context')
|
||||
);
|
||||
let osmIds = new Set<string>();
|
||||
vectorLayerFeatures = features.filter((feature: any) => {
|
||||
if (feature.get('context')) {
|
||||
return false;
|
||||
}
|
||||
const osmId = feature.get('osm_id');
|
||||
if (osmIds.has(osmId)) {
|
||||
return false;
|
||||
}
|
||||
osmIds.add(osmId);
|
||||
return true;
|
||||
});
|
||||
|
||||
selectedFeatures.sort((f1: Feature, f2: Feature) => {
|
||||
const ctx1 = f1.get('context');
|
||||
|
@ -184,7 +193,6 @@ const Infos: Component<{}> = (props) => {
|
|||
title={
|
||||
<>
|
||||
<div>
|
||||
{`${feature.get('class')}
|
||||
${feature.get('name') || ''}`}
|
||||
</div>
|
||||
<div>
|
||||
|
@ -195,8 +203,6 @@ const Infos: Component<{}> = (props) => {
|
|||
onClick={async () => {
|
||||
await Browser.open({
|
||||
url: `https://www.qwant.com/?q=${encodeURIComponent(
|
||||
feature.get('class') +
|
||||
' ' +
|
||||
feature.get('name') || ''
|
||||
)}&t=web`,
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue