cleder / czml

Read and write CZML in Python
90 stars 27 forks source link

key error on loads() #17

Open HumptyNumpty opened 9 years ago

HumptyNumpty commented 9 years ago

I am trying to read a simple czml file (see below)

trying as per the readme

doc = czml.CZML() with open(fpath, 'r') as f: doc.loads(f.read())

fails with a ValueError on bb.load(billboard) in czml.pyc

Any suggestions?

Many thanks


simple.czml

(from https://github.com/AnalyticalGraphicsInc/cesium/wiki/CZML-in-Cesium)

[ { "id":"Headquarters", "availability":"2012-06-20T16:00:00Z/2012-06-20T16:02:00Z", "position":{ "cartesian":[ 1216469.9357990976,-4736121.71856379,4081386.8856866374 ] }, "billboard":{ "color":{ "rgba":[ 0,255,255,255 ] }, "horizontalOrigin":"CENTER", "image":"http://cesiumjs.org/images/Cesium_Logo.png", "scale":1.0, "show":[ { "interval":"2012-06-20T16:00:00Z/2012-06-20T16:02:00Z", "boolean":true } ], "verticalOrigin":"CENTER" } } ]

Frencil commented 9 years ago

@HumptyNumpty while this library is stable it's not being developed as actively as Cesium itself. The example billboard document you referenced from this page:

[
  {
    "id":"Headquarters",
    "availability":"2012-06-20T16:00:00Z/2012-06-20T16:02:00Z",
    "position":{
      "cartesian":[
        1216469.9357990976,-4736121.71856379,4081386.8856866374
      ]
    },
    "billboard":{
      "color":{
        "rgba":[
          0,255,255,255
        ]
      },
      "horizontalOrigin":"CENTER",
      "image":"http://cesiumjs.org/images/Cesium_Logo.png",
      "scale":1.0,
      "show":[
        {
          "interval":"2012-06-20T16:00:00Z/2012-06-20T16:02:00Z",
          "boolean":true
        }
      ],
      "verticalOrigin":"CENTER"
    }
  }
]

Raises a ValueError when loaded because the Python/CZML library's billboard class doesn't support the following:

Taking this into consideration, this edit of the example file does load without throwing any errors:

[
  {
    "id":"Headquarters",
    "availability":"2012-06-20T16:00:00Z/2012-06-20T16:02:00Z",
    "position":{
      "cartesian":[
        1216469.9357990976,-4736121.71856379,4081386.8856866374
      ]
    },
    "billboard":{
      "color":{
        "rgba":[
          0,255,255,255
        ]
      },
      "image":"http://cesiumjs.org/images/Cesium_Logo.png",
      "scale":1.0,
      "show":true
    }
  }
]

This is certainly a shortcoming of the Python/CZML library and an opportunity for a contributor to add this support.

HumptyNumpty commented 9 years ago

Many thanks. Very helpful


On Wed, 7/10/15, Christopher Clark notifications@github.com wrote:

Subject: Re: [czml] key error on loads() (#17) To: "cleder/czml" czml@noreply.github.com Cc: "HumptyNumpty" e4see@yahoo.co.uk Date: Wednesday, 7 October, 2015, 17:59

@HumptyNumpty while this library is stable it's not being developed as actively as Cesium itself. The example billboard document you referenced from this page:

[ { "id":"Headquarters", "availability":"2012-06-20T16:00:00Z/2012-06-20T16:02:00Z", "position":{ "cartesian":[ 1216469.9357990976,-4736121.71856379,4081386.8856866374 ] }, "billboard":{ "color":{ "rgba":[ 0,255,255,255 ] }, "horizontalOrigin":"CENTER", "image":"http://cesiumjs.org/images/Cesium_Logo.png", "scale":1.0, "show":[ { "interval":"2012-06-20T16:00:00Z/2012-06-20T16:02:00Z", "boolean":true } ], "verticalOrigin":"CENTER" } } ]

Raises a ValueError when loaded because the Python/CZML library's billboard class doesn't support the following:

The horizontalOrigin attribute The verticalOrigin attribute Interval definition for the show attribute (only a boolean value is supported)

Taking this into consideration, this edit of the example file does load without throwing any errors:

[ { "id":"Headquarters", "availability":"2012-06-20T16:00:00Z/2012-06-20T16:02:00Z", "position":{ "cartesian":[ 1216469.9357990976,-4736121.71856379,4081386.8856866374 ] }, "billboard":{ "color":{ "rgba":[ 0,255,255,255 ] }, "image":"http://cesiumjs.org/images/Cesium_Logo.png", "scale":1.0, "show":true } } ]

This is certainly a shortcoming of the Python/CZML library and an opportunity for a contributor to add this support.

— Reply to this email directly or view it on GitHub.