The basemap descriptor
Optional
activate: booleanif true create the basemap and activate it
Optional
beforeId: stringif provided, add the basemap before the given id
if invalid parameters
// add an osm basemap
JMap.Map.Basemap.add({
id: "osm",
label: "Open Street Map",
tileUrls: [
"https://a.tile.openstreetmap.org/{z}/{x}/{y}.png",
"https://b.tile.openstreetmap.org/{z}/{x}/{y}.png",
"https://c.tile.openstreetmap.org/{z}/{x}/{y}.png"
],
previewImageAsUrlOrBase64: "https://searchengineland.com/figz/wp-content/seloads/2013/11/Screen-Shot-2013-11-22-at-3.41.27-PM.png"
}, true) // true = activate the new basemap
// Add a quadkey (not x/y/z) basemap
JMap.Map.Basemap.add(
{
id: "My custom map",
label: "My map",
tileUrls: [
"https://t.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{quadkey}?mkt=fr-CA&it=G,LC,BX,RL&shading=hill&n=z&og=1226&cstl=vb&src=o"
],
previewImageAsUrlOrBase64: "http://www.toxel.com/wp-content/uploads/2008/08/creativelogos11.jpg"
}, true) // true = activate the new basemap
JMap.Map.Basemap.add
Add a new basemap on the map.
You can find tile servers here : https://wiki.openstreetmap.org/wiki/Tile_servers