File size: 996 Bytes
b6d6862
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

import os
import mapwidget.cesium as mapwidget

import solara

altitude = solara.reactive(400)
center = solara.reactive((37.655, -122.4175))

if os.environ.get('CESIUM_TOKEN') is None:
    token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIzZTdkOTQ1Yy1lYzZjLTQ0M2EtOTk5My05NzJhODg3M2NjNDIiLCJpZCI6MjY1ODE3LCJpYXQiOjE3MzU1OTQ0MTl9.BBvv3l93ZIMxPp3aMS_XeAUywDzGSU2WO_etHOHp_O8'
else:
    token = os.environ.get('CESIUM_TOKEN')

@solara.component
def Page():
    with solara.Column(style={"min-width": "500px", "height": "500px"}):
        # solara components support reactive variables
        solara.SliderInt(label="Zoom level", value=altitude, min=1, max=1000)
        # using 3rd party widget library require wiring up the events manually
        # using zoom.value and zoom.set
        mapwidget.Map.element(  # type: ignore
            center=center.value,
            altitude=altitude.value,
            height='600px',
            width="100%"
        )