Leaflet_map provides a type-safe OCaml interface to the Leaflet widget:
- Leaflet_map.create: typed config (center, zoom, height) + typed callbacks
(on_click receives latlng, on_bbox_drawn receives bounds)
- Leaflet_map.add_image_overlay: typed bounds + url + opacity
- Leaflet_map.add_marker: typed latlng + optional color/label
- All JSON serialization hidden inside the wrapper
The notebook no longer uses raw Widget.command/Scanf.sscanf for map
interaction. Compare:
Before: Widget.command ~id "addImageOverlay" (Printf.sprintf {|{...}|} ...)
After: Leaflet_map.add_image_overlay map ~url ~bounds ~opacity:0.7 ()
Before: Scanf.sscanf json {|{"lat":%f,"lng":%f}|} (fun a b -> ...)
After: on_click:(fun pt -> ... pt.lat ... pt.lng ...)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>