GeoJSON¶
Example¶
#include <fstream>
#include "xleaflet/xmap.hpp"
#include "xleaflet/xbasemaps.hpp"
#include "xleaflet/xgeo_json.hpp"
auto black_and_white = xlf::basemap({"OpenStreetMap", "BlackAndWhite"});
auto map = xlf::map::initialize()
.layers({black_and_white})
.center({34.6252978589571, -77.34580993652344})
.zoom(10)
.finalize();
// Load a local file
std::ifstream file("geo.json");
xeus::xjson geo_data;
file >> geo_data;
auto geo_json = xlf::geo_json::initialize()
.data(geo_data)
.finalize();
map.add_layer(geo_json);
map
Attributes¶
Attribute |
Type |
Default Value |
Doc |
---|---|---|---|
data |
|
Data dictionary |
|
style |
|
Style dictionary |
|
hover_style |
|
Hover style dictionary |
Methods¶
Method |
Return type |
Arguments |
Doc |
---|---|---|---|
on_click |
|
|
Adds a callback on click event |
on_hover |
|
|
Adds a callback on hover event |