Skip to content
Snippets Groups Projects
layer_times.py 355 B
#!/usr/bin/env python3
import cgi
import json
import fiona

form = cgi.FieldStorage()
layer = form['layer'].value
with fiona.open(layer, 'r') as shp_file:
    times = [x['properties']['time'] for x in shp_file]

print("Content-Type: application/json")
print("Access-Control-Allow-Origin: *")
print()  # blank line, end of headers
print(json.dumps(times))