diff --git a/mapserver/cgi-bin/layer_times.py b/mapserver/cgi-bin/layer_times.py index 8666f0bf65e2d060afb56c9d6a89c8556f090887..14c42f0cffefe696fd89a494798914940d442ed7 100755 --- a/mapserver/cgi-bin/layer_times.py +++ b/mapserver/cgi-bin/layer_times.py @@ -1,12 +1,16 @@ #!/usr/bin/env python3 +import os 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] +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: *")