Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Comparing two datasets side by side with a draggable slider

Open In Colab

1. Motivation

A large share of GeoAI work is fundamentally comparative: change detection compares two dates, model evaluation compares predictions against ground truth, and data selection compares imagery from different sensors or seasons. Viewing two layers stacked on top of each other, one at a time, makes it hard to judge fine spatial differences. A split view keeps both layers visible at the same extent and zoom level.


2. Core idea

A split-panel map places two layers side by side with a draggable divider, so both sides always share the same geographic extent and zoom, which keeps the comparison spatially honest.


3. Workflow

A. Prepare sample data

This example compares SWISSIMAGE imagery, a height raster and building footprints.

B. Build a basic split comparison

split_map() accepts common layer sources, including raster and vector files, with left_args and right_args for per-side rendering options.

Loading...
Loading...

Dragging the slider left and right reveals each layer. Areas with tall structures in the imagery should line up with high values in the height raster; if they consistently do not, that is a sign the two datasets are misaligned.

C. Overlay comparison for quality control

With the standard, ipyleaflet-based leafmap.Map, split_map() handles a vector file such as this building-footprint GeoJSON exactly like a raster file, no different code path needed. This page uses leafmap.foliumap instead, so the map renders correctly on the built book website, and that backend’s split_map() only synchronizes raster tile layers. If you are working in your own notebook with plain import leafmap, you can pass buildings_path straight into split_map() just like the raster example above; here, we overlay both layers on one map instead, which is just as effective a check before trusting a set of labels.

Loading...

4. Key takeaways

  • Split-panel maps keep two layers at the same extent and zoom, which makes spatial comparisons more reliable than toggling layers on and off.

  • split_map() supports both raster and vector layers with the standard, ipyleaflet-based leafmap.Map; the leafmap.foliumap backend used on this page only synchronizes raster layers, so vector-vs-raster checks here use an overlay instead.

  • Split views are well suited to alignment checks; they do not replace quantitative evaluation metrics.

  • Consistent styling on both sides is necessary for a comparison to reflect real differences in the data rather than differences in how it was drawn.