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 [ ]:
import collections
from CesiumWidget import CesiumWidget
import czml
In [ ]:
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 [ ]:
points
In [ ]:
doc = czml.CZML()
In [ ]:
packet1 = czml.CZMLPacket(id='document',version='1.0')
doc.packets.append(packet1)
In [ ]:
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 [ ]:
cesiumExample = CesiumWidget(width="100%", czml=tuple(doc.data()))
In [ ]:
cesiumExample
In [ ]:
doc.dumps()