Home Projects Portfolio Dashboard Export PDF Log in
TypeScript

Unifying Map Visualizations: Refining DeckGL Layers in WorldMonitor

Refactoring for Consistency

In our effort to standardize mapping components within the WorldMonitor project, we recently focused on aligning our DeckGL implementation with existing legacy map logic. Our goal was to ensure a consistent experience across all geospatial data layers, specifically by synchronizing how clusters, ports, and AIS density are rendered.

Solving Data Inconsistency

We encountered discrepancies between our newer DeckGL-based maps and our mature legacy implementations. The primary challenge was ensuring that metadata—such as vessel activity types and port configurations—behaved identically across both systems.

Standardizing Metadata and Tooltips

By unifying the layer state management, we ensured that users receive consistent feedback. We implemented a unified tooltip system and refined click mappings for cluster interactions. This involved standardizing how we handle the 'active' layer state, ensuring that the UI correctly reflects the data source underlying each cluster.

interface LayerConfig {
  id: string;
  isActive: boolean;
  type: 'military' | 'commercial' | 'patrol';
  densityColor: string;
}

const updateLayerState = (layer: LayerConfig) => {
  const classList = layer.isActive ? 'layer-active' : 'layer-inactive';
  // Synchronize internal layer state with UI representation
  document.getElementById(layer.id)?.setAttribute('class', classList);
};

This snippet demonstrates the logic used to ensure that the visual state of a layer remains tightly coupled with its configuration, preventing the "ghost layer" issues we previously encountered.

Enhancing Data Insights

Beyond simple parity, we improved how we visualize AIS congestion. We introduced a threshold-based coloring system where AIS density nodes are dynamically colored orange when the delta percentage exceeds 15%.

We also cleaned up our hotspot management logic. By standardizing getHotspotLevels to utilize consistent naming conventions (h.name), we reduced runtime errors during layer re-rendering cycles. These changes make the map more responsive and visually intuitive for our primary users monitoring maritime activity.


Generated with Gitvlg.com

Unifying Map Visualizations: Refining DeckGL Layers in WorldMonitor
Keber Flores

Keber Flores

Author

Share: