Removing existing features before adding new ones.

This commit is contained in:
vdv committed 2022-12-14 08:03:42 +01:00
1 parent 040122189c
commit 600ce534fe
3 files changed
+22

No files matched your search

+4
View File
@@ -99,6 +99,10 @@ export const Wpt: Component<Props> = ({ vectorSource, wptId: wptId }) => {
const features = new GeoJSON().readFeatures(geo);
console.log({ caller: 'Wpt', features });
const feature = vectorSource.getFeatureById(wptId);
if (feature) {
vectorSource.removeFeature(feature);
}
vectorSource.addFeatures(features);
}
});