Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

key error on loads() #17

Open
HumptyNumpty opened this issue Oct 7, 2015 · 2 comments
Open

key error on loads() #17

HumptyNumpty opened this issue Oct 7, 2015 · 2 comments

Comments

@HumptyNumpty
Copy link

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
Copy link
Collaborator

Frencil commented Oct 7, 2015

@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.

@HumptyNumpty
Copy link
Author

Many thanks.
Very helpful


On Wed, 7/10/15, Christopher Clark [email protected] wrote:

Subject: Re: [czml] key error on loads() (#17)
To: "cleder/czml" [email protected]
Cc: "HumptyNumpty" [email protected]
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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants