Skip to content

Draw and export landmarks

Draw landmarks on the map, export them as vector data, and load edits back into the widget.

Goal

Move landmarks between milume and GeoPandas (or any tool that reads GeoJSON/Shapefile via GeoDataFrame).

Steps

  1. Open milume on spatial data (ileum demo):
import milume as ml

adata = ml.ds.ileum_merfish_xu2026()
w = ml.peek(adata, color="cell_type")
w
  1. Draw or edit landmarks in the browser (Landmarks). Each edit updates w.landmarks.

  2. Convert the synced list to a GeoDataFrame (geopandas required):

import geopandas as gpd
from milume import landmarks_to_geodataframe, geodataframe_to_landmarks

gdf = landmarks_to_geodataframe(w.landmarks)
gdf.to_file("landmarks.geojson", driver="GeoJSON")
  1. Edit gdf offline, then push it back:
gdf = gpd.read_file("landmarks.geojson")
w.landmarks = geodataframe_to_landmarks(gdf)
  1. Run measure helpers against the same adata and exported geometry when you need distances or composition (Measure API).

Result

landmarks.geojson (or your chosen path) matches what you drew; assigning back to w.landmarks updates the map.

Column semantics and CRS notes are in GeoDataFrame interchange.