add tile_url option

This commit is contained in:
Swrup 2022-04-07 17:58:01 +02:00
parent 2004c6ff60
commit 795508ff8f
2 changed files with 8 additions and 3 deletions

View file

@ -1,8 +1,13 @@
type t = Jv.t
let create_osm () =
let create_osm ?tile_url () =
(* see https://wiki.openstreetmap.org/wiki/Tile_servers *)
let tile_url =
Option.fold ~some:Fun.id
~none:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" tile_url
in
Jv.call Global.leaflet "tileLayer"
[| Jv.of_string "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
[| Jv.of_string tile_url
; Jv.obj
[| ( "attribution"
, Jv.of_string

View file

@ -1,5 +1,5 @@
type t
val create_osm : unit -> t
val create_osm : ?tile_url:string -> unit -> t
val add_to : t -> Map.t -> unit