Skip to content
Snippets Groups Projects
layer_times.py 424 B
Newer Older
import cgi
import json
import fiona

form = cgi.FieldStorage()
layer = form['layer'].value
if not os.path.isfile(layer):
    times = []
else:
    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))