In [1]:
Copied!
# %pip install "leafmap[maplibre]"
# %pip install "leafmap[maplibre]"
In [2]:
Copied!
import leafmap.maplibregl as leafmap
import leafmap.maplibregl as leafmap
In [3]:
Copied!
m = leafmap.Map(style="positron", projection="globe")
m.add_basemap("Satellite")
geojson = "https://github.com/opengeos/datasets/releases/download/world/mgrs_grid_zone.geojson"
m.add_geojson(geojson)
m.add_labels(geojson, "GZD", text_color="white", min_zoom=2, max_zoom=10)
m
m = leafmap.Map(style="positron", projection="globe")
m.add_basemap("Satellite")
geojson = "https://github.com/opengeos/datasets/releases/download/world/mgrs_grid_zone.geojson"
m.add_geojson(geojson)
m.add_labels(geojson, "GZD", text_color="white", min_zoom=2, max_zoom=10)
m
In [4]:
Copied!
m = leafmap.Map(style="positron", projection="globe")
m.add_basemap("Satellite")
geojson = "https://github.com/opengeos/datasets/releases/download/world/mgrs_grid_zone.geojson"
paint = {"line-color": "red"}
m.add_geojson(geojson, layer_type="line", paint=paint)
m.add_labels(geojson, "GZD", text_color="white", min_zoom=2)
m
m = leafmap.Map(style="positron", projection="globe")
m.add_basemap("Satellite")
geojson = "https://github.com/opengeos/datasets/releases/download/world/mgrs_grid_zone.geojson"
paint = {"line-color": "red"}
m.add_geojson(geojson, layer_type="line", paint=paint)
m.add_labels(geojson, "GZD", text_color="white", min_zoom=2)
m
In [5]:
Copied!
m = leafmap.Map(style="positron", projection="globe")
m.add_basemap("Satellite")
geojson = "https://github.com/opengeos/datasets/releases/download/vector/cables.geojson"
paint = {"line-color": "red"}
m.add_geojson(geojson, layer_type="line", paint=paint)
layout = {
"visibility": "visible",
"text-field": ["get", "name"],
"text-size": 14,
"text-anchor": "center",
"symbol-placement": "line",
"text-rotation-alignment": "map",
"text-offset": [0, -0.6],
"symbol-avoid-edges": False,
"text-font": ["Noto Sans Regular"],
}
paint = {
"text-color": "red",
"text-halo-color": "white",
"text-halo-width": 2,
}
m.add_labels(geojson, "id", text_color="white", min_zoom=2, layout=layout, paint=paint)
m
m = leafmap.Map(style="positron", projection="globe")
m.add_basemap("Satellite")
geojson = "https://github.com/opengeos/datasets/releases/download/vector/cables.geojson"
paint = {"line-color": "red"}
m.add_geojson(geojson, layer_type="line", paint=paint)
layout = {
"visibility": "visible",
"text-field": ["get", "name"],
"text-size": 14,
"text-anchor": "center",
"symbol-placement": "line",
"text-rotation-alignment": "map",
"text-offset": [0, -0.6],
"symbol-avoid-edges": False,
"text-font": ["Noto Sans Regular"],
}
paint = {
"text-color": "red",
"text-halo-color": "white",
"text-halo-width": 2,
}
m.add_labels(geojson, "id", text_color="white", min_zoom=2, layout=layout, paint=paint)
m
WARNING:pyogrio._io:Skipping field coordinates: unsupported OGR type: 3
WARNING:pyogrio._io:Skipping field coordinates: unsupported OGR type: 3