leaflet/example/main.ml

19 lines
504 B
OCaml
Raw Normal View History

2022-05-19 15:46:43 +02:00
(* create map *)
let map =
2022-05-19 16:16:37 +02:00
let container =
match Brr.Document.find_el_by_id Brr.G.document (Jstr.of_string "map") with
| None -> failwith "map container not found"
| Some el -> el
in
Leaflet.Map.create container
2022-05-19 15:46:43 +02:00
(* setup map *)
let () =
(* set osm layer *)
let osm_layer = Leaflet.Layer.create_tile_osm None in
Leaflet.Layer.add_to map osm_layer;
(* set view *)
let latlng = Leaflet.Latlng.create 40.71 (-74.0) in
ignore @@ Leaflet.Map.set_view latlng ~zoom:(Some 13) map