From d4ca053e990c9557ca107315dd1eb94023ecd5b7 Mon Sep 17 00:00:00 2001 From: David Hoese <david.hoese@ssec.wisc.edu> Date: Sun, 26 Jan 2020 16:42:11 -0600 Subject: [PATCH] Add custom EPSG codes to add G16/G17 support to the mapserver --- mapserver/Dockerfile | 6 ++++++ mapserver/README.md | 16 +++++++++++++++- mapserver/mapfiles/g16_abi_radf_l1b.map | 7 +++++-- mapserver/sql/goesr_crs.sql | 2 ++ tile_gen/README.md | 2 +- tile_gen/run.sh | 2 +- 6 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 mapserver/sql/goesr_crs.sql diff --git a/mapserver/Dockerfile b/mapserver/Dockerfile index 855decd..4982922 100644 --- a/mapserver/Dockerfile +++ b/mapserver/Dockerfile @@ -60,6 +60,12 @@ RUN ln -s /usr/local/bin/mapserv /usr/lib/cgi-bin/mapserv && \ COPY mapfiles/ /work/mapfiles/ COPY html/ /var/www/html/ +# Add our own custom EPSG codes (HACK) +# GOES-16 ABI Full Disk = EPSG:930916 +# GOES-17 ABI Full Disk = EPSG:930917 +COPY sql/ /work/sql/ +RUN sqlite3 -init /work/sql/goesr_crs.sql /usr/local/share/proj/proj.db + # https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop STOPSIGNAL WINCH diff --git a/mapserver/README.md b/mapserver/README.md index f925f35..7361c7f 100644 --- a/mapserver/README.md +++ b/mapserver/README.md @@ -3,9 +3,23 @@ ## Usage ```bash -docker run -p 8888:80 -d --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 -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 + +## Special Notes + +This image has had its installation of the PROJ library modified to include +new non-standard EPSG codes to support the projections of certain satellite +instruments. These additions are part of the Dockerfile build process and +include the following definitions: + +1. EPSG:930916 - The GOES-16 ABI Fixed Grid geostationary coordinate reference + system. The numbers are meant to represent "GEOG16" while also attempting + to avoid conflicts with future additions to the official EPSG database. +2. EPSG:930917 - The GOES-17 ABI Fixed Grid geostationary coordinate reference + system. The numbers are meant to represent "GEOG17" while also attempting + to avoid conflicts with future additions to the official EPSG database. diff --git a/mapserver/mapfiles/g16_abi_radf_l1b.map b/mapserver/mapfiles/g16_abi_radf_l1b.map index e90aa7a..d989dc4 100644 --- a/mapserver/mapfiles/g16_abi_radf_l1b.map +++ b/mapserver/mapfiles/g16_abi_radf_l1b.map @@ -4,7 +4,7 @@ MAP EXTENT -180 -90 180 90 PROJECTION - "init=epsg:4326" + "init=epsg:930916" END WEB @@ -34,7 +34,7 @@ MAP # Comment below to default to transparency # OFFSITE 0 0 0 PROJECTION - "auto" + "init=epsg:930916" END METADATA "wms_title" "GOES-16 ABI True Color" @@ -91,6 +91,9 @@ MAP TILEINDEX "true_color_index" # Comment below to default to transparency # OFFSITE 0 0 0 + PROJECTION + "init=epsg:930916" + END METADATA "wms_title" "GOES-16 ABI True Color" "wms_extent" "-180 -90 180 90" diff --git a/mapserver/sql/goesr_crs.sql b/mapserver/sql/goesr_crs.sql new file mode 100644 index 0000000..0cbf495 --- /dev/null +++ b/mapserver/sql/goesr_crs.sql @@ -0,0 +1,2 @@ +INSERT INTO projected_crs (auth_name, code, name, description, scope, coordinate_system_auth_name, coordinate_system_code, geodetic_crs_auth_name, geodetic_crs_code, conversion_auth_name, conversion_code, area_of_use_auth_name, area_of_use_code, text_definition, deprecated) VALUES ('EPSG', '930917', 'GOES-17 ABI Fixed Grid', 'GOES-17 (GOES-WEST) ABI Fixed Grid in the Geostationary projection', null, null, null, 'EPSG', '4269', null, null, null, null, 'PROJCRS["GOES-17 ABI Fixed Grid",BASEGEOGCRS["GOES-17 ABI Fixed Grid",DATUM["North American Datum 1983",ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]],ID["EPSG",6269]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Geostationary Satellite (Sweep X)"],PARAMETER["Longitude of natural origin",-137,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Satellite Height",35786023,LENGTHUNIT["metre",1,ID["EPSG",9001]]],PARAMETER["False easting",0,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]]', 0); +INSERT INTO projected_crs (auth_name, code, name, description, scope, coordinate_system_auth_name, coordinate_system_code, geodetic_crs_auth_name, geodetic_crs_code, conversion_auth_name, conversion_code, area_of_use_auth_name, area_of_use_code, text_definition, deprecated) VALUES ('EPSG', '930916', 'GOES-16 ABI Fixed Grid', 'GOES-16 (GOES-WEST) ABI Fixed Grid in the Geostationary projection', null, null, null, 'EPSG', '4269', null, null, null, null, 'PROJCRS["GOES-16 ABI Fixed Grid",BASEGEOGCRS["GOES-16 ABI Fixed Grid",DATUM["North American Datum 1983",ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]],ID["EPSG",6269]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Geostationary Satellite (Sweep X)"],PARAMETER["Longitude of natural origin",-75,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Satellite Height",35786023,LENGTHUNIT["metre",1,ID["EPSG",9001]]],PARAMETER["False easting",0,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1,ID["EPSG",9001]]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1,ID["EPSG",9001]]]]', 0); \ No newline at end of file diff --git a/tile_gen/README.md b/tile_gen/README.md index 290548a..ac6fa4d 100644 --- a/tile_gen/README.md +++ b/tile_gen/README.md @@ -10,7 +10,7 @@ docker push gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/tile_gen:late ## Usage ```bash -docker run -d --rm --network cspp-geo-rabbit --cpus 2 --name cspp-geo-tilegen-g16-radf -e AMQPFIND_TOPIC="data.goes.g16.abi.radf.l1b.geotiff.complete" -v cspp-geo-abi-l1b-geotiffs:/data gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/tile_gen:latest +docker run -d --rm --network cspp-geo-rabbit --cpus 2 --name cspp-geo-tilegen-g16-radf -e AMQPFIND_TOPIC="data.goes.g16.abi.radf.l1b.geotiff.complete" -v cspp-geo-abi-l1b-geotiffs:/data gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/tile_gen:latest ./run.sh ``` To run the version of tile generation that remaps to EPSG:4326: diff --git a/tile_gen/run.sh b/tile_gen/run.sh index 18f1bf4..449169b 100755 --- a/tile_gen/run.sh +++ b/tile_gen/run.sh @@ -69,7 +69,7 @@ run_tile_gen() { glob_pattern="${glob_pattern/${dst_dir}\//}" amqpsend_topic="data.${satellite_family}.${satellite_id}.${instrument}.${data_type}.l1b.tiledb.complete" - json_info="{path: ${glob_pattern}, satellite_family: ${satellite_family}, satellite_ID: ${satellite_id}, instrument: ${instrument}, data_type: ${data_type}}" +# json_info="{path: ${glob_pattern}, satellite_family: ${satellite_family}, satellite_ID: ${satellite_id}, instrument: ${instrument}, data_type: ${data_type}}" json_info="{\"path\": \"${glob_pattern}\", \"satellite_family\": \"${satellite_family}\", \"satellite_ID\": \"${satellite_id}\", \"instrument\": \"${instrument}\", \"data_type\": \"${data_type}\"}" echo -e "[[\"$amqpsend_topic\", $json_info]]" | python3 /work/amqpfind/amqpsend.py ${AMQPSEND_ARGS} echo "Done generating tiles for ${path}" -- GitLab