#include "xleaflet/xmap.hpp"
#include "xleaflet/xbasemaps.hpp"
auto map = xlf::map::initialize()
.center({52.204793, 360.121558})
.zoom(9)
.finalize();
auto dark_matter_layer = xlf::basemap({"CartoDB", "DarkMatter"});
map.add_layer(dark_matter_layer);
map
Creating a tile_layer
is straightforward, a list of basic tile layers is provided. This list of layers can be accessed using the basemaps
function:
#include <iostream>
#include "xleaflet/xbasemaps.hpp"
std::cout << xlf::basemaps().dump(6) << std::endl;
A tile_layer
instance can be created using the basemap
function, specifying the wanted map (e.g. {"CartoDB", "DarkMatter"}
, {"Strava", "Winter"}
, {"NASAGIBS", "ModisTerraTrueColorCR"}
, ...).
Sometimes one could want to specify the date of the given images, for instance with NASA images:
auto nasa_layer = xlf::basemap({"NASAGIBS", "ModisTerraTrueColorCR"}, "2018-04-08");
map.add_layer(nasa_layer);
Attribute | Type | Default Value |
---|---|---|
url | std::string |
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" |
min_zoom | int |
0 |
max_zoom | int |
18 |
tile_size | int |
256 |
attribution | std::string |
"Map data (c) <a href='https://openstreetmap.org\'>OpenStreetMap</a> contributors" |
detect_retina | bool |
false |
opacity | float |
1.0 |
visible | bool |
true |