diff --git a/mapserver/README.md b/mapserver/README.md index 7361c7f4a16ccdd6fa4854c5ed4fcdf4007097d9..93aa368e162f7323863c1f5b73e2fe47ea3dc36e 100644 --- a/mapserver/README.md +++ b/mapserver/README.md @@ -1,15 +1,34 @@ # MapServer +## Build + +```bash +docker build -t gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/mapserver:latest mapserver/ +``` + ## Usage ```bash -docker run -p 8888:80 -d --rm --name cspp-geo-mapserver -v cspp-geo-abi-l1b-geotiffs:/data gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/mapserver:latest +docker run -p 8888:80 -d --rm --name cspp-geo-mapserver --network cspp-geo-rabbit -v cspp-geo-abi-l1b-geotiffs:/data gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/mapserver:latest ``` Then the main mapserv CGI script can be accessed with: http://localhost:8888/cgi-bin/mapserv +where MapServer parameters can be appended to the end (after a `?`). However, +an easier to access API is available: + +```bash +http://localhost:8888/wms/<satellite>/<instrument>/<sector>/<data_level>?... +``` + +An example URL of this including MapServer parameters is: + +```bash +http://localhost:8888/wms/g16/abi/radf/l1b?request=GetMap&service=WMS&version=1.1.1&srs=EPSG:930916&layers=true_color_test&bbox=-5000000,-5000000,5000000,5000000&format=image/png&WIDTH=1000&HEIGHT=1000&TIME=2020-01-21T16:00:16 +``` + ## Special Notes This image has had its installation of the PROJ library modified to include 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: *") diff --git a/tile_gen/tile_index.py b/tile_gen/tile_index.py index 2514c4b29d1fe7b4d676fbb787aff190a4a28d38..dfdfcc894587918744f369c03965522d6352ba85 100644 --- a/tile_gen/tile_index.py +++ b/tile_gen/tile_index.py @@ -110,7 +110,7 @@ def index(input_files, output_shapefile): shutil.rmtree(tmp_dir, ignore_errors=True) times_removed = current_times - new_times - times_added = new_times = current_times + times_added = new_times - current_times return sorted(times_removed), sorted(times_added)