Session Management
Description
When GeoGirafe starts, a user session is created. This session saves the complete state of the map (position, layers, selections, etc.) and certain components in the browser's sessionStorage, allowing it to be restored after a page refresh.
To remove the shared state, open a new tab or remove #session
from the URL.
The state is tied to the current tab (no persistence between tabs).
Data Saved in a Session
The following information is automatically saved in the session:
- Map position (center, zoom, tooltip, etc.)
- Layer configuration (selected or not, opacity, filters, swipe, etc.)
- 3D state and camera position
- Active basemap
- Current projection
- Selected objects (via click or WFS-Query)
- Features drawn on the map
The following is NOT saved in the session:
- User preferences (colors, dark mode, language, etc.)
- Bookmarks
- Anything related to authentication
State of External Components
The state of external components (developed outside GeoGirafe) can be included in the application state. To do this:
- The object containing the external component's state must implement the
IBrainSerializable
interface:
export class MyExtendedState implements IBrainSerializable {
isBrainSerializable = true;
coordinates: Coordiante[] = [];
}
- This object must be stored in
ExtendedState
:
StateManager.getInstance().state.extendedState.myExtendedState = new MyExtendedState();
- Define a Serialization class for this object, specifying how to save and restore the state:
export default class MyExtendedStateSerializer implements IBrainSerializer<MyExtendedState> {
public brainSerialize(myExtendedState: DrawingState): string {
// Code to serialize the state...
return JSON.stringify(myExtendedState);
}
public brainDeserialize(str: string) {
// Code to deserialize AND set the state
const myExtendedState = JSON.parse(str);
this.state.extendedState.myExtendedState = new MyExtendedState(/* ... */);
}
}
- Link the object containing the extended state to the serialization class:
StateSerializer.getInstance().addSerializer(DrawingState, new DrawingSerializer());
Share-Links
The state saved in the session can also be shared via the map sharing tool.
Compatibility Note:
- To be able to share a session state, GeoMapFish >= 2.9 (minimum version of september 2025) is required.
- For previous version, a solution exists, but not everything can be shared due to a limitation in the URL-Length.