Skip to content

Commit

Permalink
add MapServer configuration file for MapServer 8 (ECCC-CCCS#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dukestep authored and Geomet user for nightly docker builds committed Jan 13, 2025
1 parent 898ed42 commit 249424c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ ENV BASEDIR=/data/web/geomet-climate-nightly \
# GEOMET_CLIMATE_ES_PASSWORD=bar
# ES credentials loaded from host env
GEOMET_CLIMATE_ES_URL=https://${GEOMET_CLIMATE_ES_USERNAME}:${GEOMET_CLIMATE_ES_PASSWORD}@localhost:9200 \
GEOMET_CLIMATE_OWS_DEBUG=5
GEOMET_CLIMATE_OWS_DEBUG=5 \
MAPSERVER_CONFIG_FILE=${GEOMET_CLIMATE_BASEDIR}/mapserver.conf
# GEOMET_CLIMATE_OWS_LOG=/tmp/geomet-climate-ows.log

WORKDIR $BASEDIR
Expand Down
15 changes: 15 additions & 0 deletions geomet_climate/mapfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@

THISDIR = os.path.dirname(os.path.realpath(__file__))

MAPSERVER_CONFIG = f'''CONFIG
ENV
MS_MAP_PATTERN "{BASEDIR}/mapfile/.*"
END
END
'''


def gen_web_metadata(m, c, service, url):
"""
Expand Down Expand Up @@ -396,6 +403,14 @@ def mapfile():
def generate(ctx, service, layer):
"""generate mapfile"""

# generate MapServer config file if not present
mapserver_config_file = os.path.join(BASEDIR, 'mapserver.conf')

if not os.path.exists(mapserver_config_file):
os.makedirs(BASEDIR, exist_ok=True)
with open(mapserver_config_file, 'w+') as f:
f.write(MAPSERVER_CONFIG)

output_dir = '{}{}mapfile'.format(BASEDIR, os.sep)
template_dir = '{}{}mapfile{}template'.format(BASEDIR, os.sep, os.sep)

Expand Down

0 comments on commit 249424c

Please sign in to comment.