This notebook shows how to use the CesiumWidget together with the CZML library from https://github.com/cleder/czml
If the CesiumWidget is installed correctly, Cesium should be accessable at: http://localhost:8888/nbextensions/CesiumWidget/cesium/index.html
In [1]:
    
import collections
from CesiumWidget import CesiumWidget
import czml
    
In [6]:
    
points = collections.OrderedDict()
points['p1'] = [18.07,59.33, 20]
points['p2'] = [19.07,59.33, 20]
points['p3'] = [20.07,59.33, 20]
    
In [7]:
    
points
    
    Out[7]:
In [8]:
    
doc = czml.CZML()
    
In [9]:
    
packet1 = czml.CZMLPacket(id='document',version='1.0')
doc.packets.append(packet1)
    
In [10]:
    
for i,v in enumerate(points):
    print(i,v)
    p = czml.CZMLPacket(id=i)
    p.position = czml.Position(cartographicDegrees = points[v])
    point = czml.Point(pixelSize=20, show=True)
    point.color = czml.Color(rgba=(223, 150, 47, 128))
    point.show = True
    p.point = point
    l = czml.Label(show=True, text=v)
    l.scale = 0.5
    p.label = l
    doc.packets.append(p)
    
    
In [11]:
    
cesiumExample = CesiumWidget(width="100%", czml=doc.dumps())
    
In [12]:
    
cesiumExample
    
In [13]:
    
doc.dumps()
    
    Out[13]:
In [ ]: