czml icon indicating copy to clipboard operation
czml copied to clipboard

problem making a roper CZML polyline

Open epifanio opened this issue 9 years ago • 3 comments

I’m trying to visualize a polyline in cesium via czml. The czml I’m trying to load is available at:

https://gist.github.com/ae4c6bf491949e711ab7

unfortunately, I'm not able to visualize it in cesium.

Is there any way to validate it ? below an attempt to generate a czml Polyline

http://nbviewer.ipython.org/gist/epifanio/232f1f7ae3212ca68353/cesium-czml-test.ipynb

epifanio avatar Aug 02 '15 23:08 epifanio

I manually created a polyline using a simple template:

http://nbviewer.ipython.org/gist/epifanio/c45fa0c6a6cbc98484ea

do you know of any example online on making simple features (point, line, polygons) with python CZML?

epifanio avatar Aug 04 '15 12:08 epifanio

https://github.com/cleder/czml/blob/master/czml/test_main.py#L664

cleder avatar Aug 11 '15 13:08 cleder

I tried the test code, but i'm not able to generate a proper czml from it.

I tried the following :

from czml import utils
from czml import czml
from pygeoif import geometry

sc = czml.SolidColor(color={'rgba': [0, 255, 127, 55]})
m1 = czml.Material(solidColor=sc)
c1 = geometry.LineString([(0, 0, 0), (10, 0, 0), (70, 0, 0)])
v1 = czml.Positions(cartographicDegrees=c1)
p1 = czml.Polyline(show=True, width=5, followSurface=False, material=m1, positions=v1)
packet = czml.CZMLPacket(id='abc')
packet.polyline = p1

I tried to load : packet.dumps() into the cesium wdget with: cesiumExample = CesiumWidget(width="100%", czml=packet.dumps())

but doesn't load.

Then I tried to make a czml by hand (same data) :

pl = """[
    {
    "version": "1.0",
    "id": "document"
    },
    {
    "polyline": {
        "width":1,
        "material":{
            "solidColor":{
                "color":{
                    "rgba":[0,255,255,255]
                  }
            }
          },
        "positions": {
            "cartographicDegrees": [0.0, 0.0, 0.0, 10.0, 0.0, 0.0, 70.0, 0.0, 0.0]
            }
        }, 
        "id": "test_0", "description":"{'LENGTH': 11200.273438, 'FNODE_': 1}"
        }
 ]
"""

and it works fine.

I'm missing basic steps to use the python interface to czml to generate a complete CZML-string-object wfich can then be loaded using the : cesiumExample = CesiumWidget(width="100%", czml=CZML-string-object

epifanio avatar Aug 21 '15 17:08 epifanio