Loading CZML from URL

Hi,
I want to load Data from an URL. The URL points towards a python script which will get processed through mod_wsgi returning CZML complaint JSON.
Here is the JavaScript snippet:

var url = “http://geonode-dev.aes.hs-owl.de/py/writeCZML.py”;
var pySource = Cesium.CzmlDataSource.load(url);
viewer.dataSources.add(pySource);

``

Here is the Python script (http://geonode-dev.aes.hs-owl.de/py/writeCZML.py):

from czml import czml

def application(environ, start_response):
status = ‘200 OK’

output = createTestOutput()
response_headers = [('Content-type', 'text/json'),
                    ('Content-Length', str(len(output)))]

start_response(status, response_headers)

return [output]

def createTestOutput():
# Create and append the document packet
doc = czml.CZML()
# Create and append the document packet
czmlBasePacket = czml.CZMLPacket(id=‘document’, version=‘1.0’)
doc.packets.append(czmlBasePacket)

# create packet
p = czml.CZMLPacket(id='point_test')
# init position object
pos = czml.Position()
# use coordinates
coords = [0, 52, 0]
# put coordinates into position objects coordinate list
pos.cartographicDegrees = coords
# create point object
point = czml.Point()
# add cord data to package
p.position = pos

point.color = {'rgba': [0, 255, 127, 55]}
point.pixelSize = 10
point.outlineWidth = 2
p.point = point

# add package to main czml document
doc.packets.append(p)
doc.dumps()

# responding as JSON
return doc.dumps()

``

This is the response I get via loading the python URL (http://geonode-dev.aes.hs-owl.de/py/writeCZML.py) through my browser:

[
 {
 "version": "1.0",
 "id": "document"
 },
 {
 "position": {
 "cartographicDegrees": [
 0.0,
 52.0,
 0.0
 ]
 },
 "id": "point_test",
 "point": {
 "color": {
 "rgba": [
 0,
 255,
 127,
 55
 ]
 },
 "pixelSize": 10,
 "outlineWidth": 2,
 "show": false
 }
 }
]

I do not understand what prevents this to work. Any hints?
thanks,
Florian

Hello Florian,

Do you see any errors in the console? I don’t see any obvious problem with what you’re trying to do.

Best,

Hannah

no errors.

After rechecking the czml i´ve seen that show defaults to false:

 "show": false

so the reason why it won´t show up is quite obvious…

:smiley: