C++ backend for the jupyter-leaflet map visualization library

Layer Group


In [ ]:
#include "xleaflet/xmap.hpp"
#include "xleaflet/xbasemaps.hpp"
#include "xleaflet/xlayer_group.hpp"
#include "xleaflet/xcircle.hpp"
#include "xleaflet/xmarker.hpp"
#include "xleaflet/xrectangle.hpp"

In [ ]:
auto toner = xlf::basemap({"Stamen", "Toner"});

auto map = xlf::map_generator()
    .layers({toner})
    .center({50, 354})
    .zoom(5)
    .finalize();

map

 Create some layers


In [ ]:
auto marker = xlf::marker_generator()
    .location({50, 354})
    .finalize();
auto circle = xlf::circle_generator()
    .location({50, 370})
    .radius(50000)
    .color("yellow")
    .fill_color("yellow")
    .finalize();
auto rectangle = xlf::rectangle_generator()
    .bounds({{{54, 354}, {55, 360}}})
    .color("orange")
    .fill_color("orange")
    .finalize();

 Create layer_group


In [ ]:
auto layer_group = xlf::layer_group_generator()
    .layers({marker, circle})
    .finalize();

map.add_layer(layer_group);

 Add a new layer to the layer_group


In [ ]:
layer_group.add_layer(rectangle);

Remove a layer from the layer_group


In [ ]:
layer_group.remove_layer(circle)

In [ ]:
layer_group.clear_layers();