Read and write CZML in Python
Project description
This is an open source python library to read and write CZML files for Cesium, the WebGL Earth modeling engine.
Requirements
Tests
To run the tests (in the czml directory):
> python setup.py test
czml is continually tested with Travis CI
Usage and Examples
Reading CZML
Reading a CZML file into a mutable document object can be done by initializing a CZML document and then reading the file’s contents into the loads() method on the document, like so:
# Import the library from czml import czml # Read an existing CZML file filename = 'example.czml' with open(filename, 'r') as example: doc = czml.CZML() doc.loads(example.read())
Writing CZML
The general approach to writing CZML with this python library is to define a document object, define packets and append them to the document, and then write the document to a file using the write() method:
# Import the library from czml import czml # Initialize a document doc = czml.CZML() # Create and append the document packet packet1 = czml.CZMLPacket(id='document',version='1.0') doc.packets.append(packet1) # Create and append a billboard packet packet2 = czml.CZMLPacket(id='billboard') bb = czml.Billboard(scale=0.7, show=True) bb.image = 'http://localhost/img.png' bb.color = {'rgba': [0, 255, 127, 55]} packet2.billboard = bb doc.packets.append(packet2) # Write the CZML document to a file filename = "example.czml" doc.write(filename)
Supported CZML Components
The components in this library are developed to follow the CZML Content documentation. Supported components and subcomponents are listed in docs/COMPONENTS.md.
v 0.3.2 (2015/03/23)
Added czml.write() method
Updated broken write example in README to use write() method
Added read example to README
Cleaned up some of the framework (load/data/init) methods for CZMLPacket and others
v 0.3.1 (2015/03/19)
Added usage example to README
Added docs/COMPONENTS.md
Minor cleanup from 0.3 release
v 0.3 (2015/03/09)
Replace VertexPositions with Positions [Christopher Clark (Frencil)]
Rebuild two-dimensional object classes and tests for current CZML [Christopher Clark (Frencil)]
Add/update all documented material subclasses (Grid, Image, Stripe, SolidColor, PolylineGlow, PolylineOutline) [Christopher Clark (Frencil)]
Add document object support (including version and Clock) [Christopher Clark (Frencil)]
Restrict support to Python 2.7 and 3.3+ [Christopher Clark (Frencil)]
v 0.2 (unreleased)
Fixed bug in the Number class [Carl Fischer (Carl4)]
Add Radii, Orientation, Path, Ellipsoid, Cone, Ellipse [Carl Fischer (Carl4)]
v 0.1 (2013/04/05)
Initial release [Christian Lederman (cleder)]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file czml-0.3.2.tar.gz
.
File metadata
- Download URL: czml-0.3.2.tar.gz
- Upload date:
- Size: 30.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76b1c4324fadb2787cbd403c131efbf91c484331a44542022d461e46f83d61f2 |
|
MD5 | b0f88f5c5366c2d12bb1b4fad8e32c3c |
|
BLAKE2b-256 | 019cf51b8b3569717dd12cc3db5d1c2d35033cac9edaed4d6eeec02020e12d54 |
File details
Details for the file czml-0.3.2-py3.3.egg
.
File metadata
- Download URL: czml-0.3.2-py3.3.egg
- Upload date:
- Size: 46.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 719e1f18876625d5f01de83faa390f56839e33e13c9f7da0a80336bd4588b500 |
|
MD5 | bc1eb7572f4b055c7af841a469849018 |
|
BLAKE2b-256 | de8cd96b13ac97a70a0505cbf6887eca386fd0504ee084e23235bdca9384e971 |
File details
Details for the file czml-0.3.2-py2.7.egg
.
File metadata
- Download URL: czml-0.3.2-py2.7.egg
- Upload date:
- Size: 45.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08726fad6eeb42254074f6941221a44f62a9ab5f9c247b217acc3a2ef5325efb |
|
MD5 | e8f7149ca5dd52a7568a6a7509be8585 |
|
BLAKE2b-256 | 15c2529f14536f6e3f6e321ae37c64bdf467b82fac6bd5f05bb75da6c066241e |