Closed ambarja closed 2 months ago
@ambarja You need to activate the message queue to make it work when using the MapWidget
object:
m = Map(map_options)
m.use_message_queue()
# ...
with open("app.html", "w") as f:
f.write(m.to_html(style="height: 800px;"))
I will activate this by default in a future release :-)
@ambarja You need to activate the message queue to make it work when using the
MapWidget
object:m = Map(map_options) m.use_message_queue() # ... with open("app.html", "w") as f: f.write(m.to_html(style="height: 800px;"))
I will activate this by default in a future release :-) @crazycapivara I have been used this code, but the result is the same :c
Google Colab
Web Browser
You have to do this directly after initializing the map, otherwise it will not work!
You have to do this directly after initializing the map, otherwise it will not work!
please Is possible to share an example ? 🙏😢
from maplibre import Layer, LayerType, MapOptions
from maplibre.controls import FullscreenControl
from maplibre.ipywidget import MapWidget as Map
from maplibre.sources import GeoJSONSource
vancouver_blocks = GeoJSONSource(
data="https://raw.githubusercontent.com/visgl/deck.gl-data/master/examples/geojson/vancouver-blocks.json",
)
map_options = MapOptions(
center=(-123.1256, 49.24658),
zoom=12,
hash=True,
pitch=35,
)
m = Map(map_options)
m.use_message_queue()
m.add_control(FullscreenControl())
m.add_layer(
Layer(
type=LayerType.LINE,
source=vancouver_blocks,
paint={"line-color": "white"},
)
)
temp_file = "/tmp/pymaplibregl.html"
with open(temp_file, "w") as f:
f.write(m.to_html(style="height: 800px;"))
@crazycapivara thank you very much for the support! 🚀 ❤️
I would like to know if when exporting to an html file it can show the objects displayed as shown in the following screenshot. I have exported as html, but I can't visualizar the object (geopandas and raster tile).
Output in Google Colab
HTML output in the web browser