Skip to content

Commit

Permalink
Assign IDs to features when creating
Browse files Browse the repository at this point in the history
  • Loading branch information
gjmooney committed Jan 10, 2025
1 parent 8530570 commit 02c6f93
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/base/src/mainview/mainView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
import { IObservableMap, ObservableMap } from '@jupyterlab/observables';
import { User } from '@jupyterlab/services';
import { JSONValue, UUID } from '@lumino/coreutils';
import { Collection, Map as OlMap, View } from 'ol';
import { Collection, Map as OlMap, View, getUid } from 'ol';
import { ScaleLine } from 'ol/control';
import { GeoJSON, MVT } from 'ol/format';
import DragAndDrop from 'ol/interaction/DragAndDrop';
Expand Down Expand Up @@ -439,6 +439,10 @@ export class MainView extends React.Component<IProps, IStates> {

const featureCollection = new Collection(featureArray);

featureCollection.forEach(feature => {
feature.setId(getUid(feature));
});

newSource = new VectorSource({
features: featureCollection
});
Expand Down

0 comments on commit 02c6f93

Please sign in to comment.