Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Enable all buildOptions, fix dist path

ZachTRice4099c7af50ef
diff --git a/tasks/buildOptions.sh b/tasks/buildOptions.sh
index 56c8b764b..f6d260b54 100755
--- a/tasks/buildOptions.sh
+++ b/tasks/buildOptions.sh
@@ -32,130 +32,130 @@ OPT_SUBDIR="${CONFIG_ENV-release}"
CONFIG=$(echo $SRC_DIR | sed s_tasks/../__)
echo "Using $CONFIG ($OPT_SUBDIR)"
-# # Copy options files to build directory, and various other file operations
-# rm -rf "$BUILD_DIR" "$DEST_DIR"
-# mkdir -p "$BUILD_DIR" "$DEST_DIR"
-
-# cp -r "$SRC_DIR"/common/* "$BUILD_DIR"
-
-# if hash rsync 2>/dev/null; then
-# rsync -a "$SRC_DIR/$OPT_SUBDIR"/* "$BUILD_DIR"
-# else
-# cp -r "$SRC_DIR/$OPT_SUBDIR"/* "$BUILD_DIR"
-# fi
-
-# mkdir -p "$DEST_DIR/config"
-# mkdir -p "$BUILD_DIR/colormaps"
-
-# # If $FETCH_GC is set, make various API requests
-# if [ "$FETCH_GC" ] ; then
-# # Fetch GC files and create colormaps, vectordata and vectorstyle files
-# rm -rf "$OPT_DIR/$OPT_SUBDIR/gc/*"
-# rm -rf "$OPT_DIR/$OPT_SUBDIR/colormaps/gc/*"
-# `node $SCRIPTS_DIR/getCapabilities.js \
-# --config "$OPT_DIR/$OPT_SUBDIR/config.json" \
-# --getcapabilities "$OPT_DIR/$OPT_SUBDIR/gc"`
-
-# # Get metadata for files in layerOrder.json and combine this data into 1 file
-# rm -rf "$OPT_DIR/$OPT_SUBDIR/layer-metadata"
-# mkdir -p "$OPT_DIR/$OPT_SUBDIR/layer-metadata"
-# `node $SCRIPTS_DIR/getVisMetadata.js \
-# --features "$BUILD_DIR/features.json" \
-# --layerOrder "$BUILD_DIR/config/wv.json/layerOrder.json" \
-# --layerMetadata "$OPT_DIR/$OPT_SUBDIR/layer-metadata/all.json"`
-# else
-# # Validate layers in wv.json with a JSON schema
-# `node $SCRIPTS_DIR/validateConfigs.js \
-# --inputDirectory "$SRC_DIR/common/config/wv.json/layers" \
-# --schemaFile "$BASE/schemas/layer-config.json"`
-
-# if [ -e "$BUILD_DIR/features.json" ] ; then
-# cp "$BUILD_DIR/features.json" "$BUILD_DIR/config/wv.json/_features.json"
-# fi
-
-# # Run extractConfigFromWMTS.js script with config.json
-# if [ -e "$BUILD_DIR/config.json" ] ; then
-# `node $SCRIPTS_DIR/extractConfigFromWMTS.js \
-# --config "$BUILD_DIR/config.json" \
-# --inputDir "$BUILD_DIR/gc" \
-# --outputDir "$BUILD_DIR/_wmts"`
-# fi
-
-# # Run processVectorStyles.js and move vectorstyles where we want them
-# if [ -e "$BUILD_DIR/gc/vectorstyles" ] ; then
-# mkdir -p "$BUILD_DIR/config/wv.json/vectorstyles"
-# `node $SCRIPTS_DIR/processVectorStyles.js \
-# --inputDir "$BUILD_DIR/gc/vectorstyles" \
-# --outputDir "$BUILD_DIR/config/wv.json/vectorstyles"`
-# fi
-
-# # Run processVectorData.js and move vectordata where we want them
-# if [ -e "$BUILD_DIR/gc/vectordata" ] ; then
-# mkdir -p "$BUILD_DIR/config/wv.json/vectordata"
-# `node $SCRIPTS_DIR/processVectorData.js \
-# --inputDir "$BUILD_DIR/gc/vectordata" \
-# --outputDir "$BUILD_DIR/config/wv.json/vectordata"`
-# fi
-
-# # Run processColormap.js and move colormaps where we want them
-# if [ -e "$BUILD_DIR/colormaps" ] ; then
-# mkdir -p "$BUILD_DIR"/config/palettes
-# if [ -d "$BUILD_DIR"/gc/colormaps ] ; then
-# cp -r "$BUILD_DIR"/gc/colormaps "$BUILD_DIR"/colormaps/gc
-# fi
-# `node $SCRIPTS_DIR/processColormap.js \
-# --config "$OPT_DIR/$OPT_SUBDIR/config.json" \
-# --inputDir "$BUILD_DIR/colormaps" \
-# --outputDir "$BUILD_DIR/config/palettes"`
-# fi
-
-# # Throw error if no categoryGroupOrder.json file present
-# if [ ! -e "$BUILD_DIR/config/wv.json/categoryGroupOrder.json" ] ; then
-# echo "categoryGroupOrder.json not found. Generating..."
-# `node $SCRIPTS_DIR/generateCategoryGroupOrder.js \
-# --inputDir "$SRC_DIR/common/config/wv.json/categories/" \
-# --outputDir "$SRC_DIR/common/config/wv.json/"`
-# fi
-
-# if [ -e "$OPT_DIR/$OPT_SUBDIR/layer-metadata/all.json" ] ; then
-# cp "$OPT_DIR/$OPT_SUBDIR/layer-metadata/all.json" "$BUILD_DIR/config/wv.json/layer-metadata.json"
-# fi
-
-# # Run mergeConfig.js on each directory in /config containing .json files
-# # This creates on palettes-custom.json and wv.json
-# configs=$(ls "$BUILD_DIR/config")
-# for config in $configs; do
-# case $config in
-# *.json)
-# bash -c "node $SCRIPTS_DIR/mergeConfig.js \
-# --inputDir '$BUILD_DIR/config/$config' \
-# --outputFile '$DEST_DIR/config/$config'"
-# ;;
-# *)
-# cp -r "$BUILD_DIR/config/$config" "$DEST_DIR/config/$config"
-# ;;
-# esac
-# done
-
-# # Run mergeConfigWithWMTS.js to merge layer metadata from WMTS GC with worldview layer configs into wv.json
-# `node $SCRIPTS_DIR/mergeConfigWithWMTS.js \
-# --inputDir "$BUILD_DIR/_wmts" \
-# --outputFile "$DEST_DIR/config/wv.json"`
-
-# # Copy brand files from build to dest
-# cp -r "$BUILD_DIR/brand" "$DEST_DIR"
-# cp "$BUILD_DIR/brand.json" "$DEST_DIR"
-
-
-# # Validate the options build
-# `node $SCRIPTS_DIR/validateOptions.js \
-# --optionsFile "$BUILD_DIR/config.json" \
-# --configDir "$DEST_DIR/config"`
+# Copy options files to build directory, and various other file operations
+rm -rf "$BUILD_DIR" "$DEST_DIR"
+mkdir -p "$BUILD_DIR" "$DEST_DIR"
+
+cp -r "$SRC_DIR"/common/* "$BUILD_DIR"
+
+if hash rsync 2>/dev/null; then
+ rsync -a "$SRC_DIR/$OPT_SUBDIR"/* "$BUILD_DIR"
+else
+ cp -r "$SRC_DIR/$OPT_SUBDIR"/* "$BUILD_DIR"
+fi
+
+mkdir -p "$DEST_DIR/config"
+mkdir -p "$BUILD_DIR/colormaps"
+
+# If $FETCH_GC is set, make various API requests
+if [ "$FETCH_GC" ] ; then
+ # Fetch GC files and create colormaps, vectordata and vectorstyle files
+ rm -rf "$OPT_DIR/$OPT_SUBDIR/gc/*"
+ rm -rf "$OPT_DIR/$OPT_SUBDIR/colormaps/gc/*"
+ `node $SCRIPTS_DIR/getCapabilities.js \
+ --config "$OPT_DIR/$OPT_SUBDIR/config.json" \
+ --getcapabilities "$OPT_DIR/$OPT_SUBDIR/gc"`
+
+ # Get metadata for files in layerOrder.json and combine this data into 1 file
+ rm -rf "$OPT_DIR/$OPT_SUBDIR/layer-metadata"
+ mkdir -p "$OPT_DIR/$OPT_SUBDIR/layer-metadata"
+ `node $SCRIPTS_DIR/getVisMetadata.js \
+ --features "$BUILD_DIR/features.json" \
+ --layerOrder "$BUILD_DIR/config/wv.json/layerOrder.json" \
+ --layerMetadata "$OPT_DIR/$OPT_SUBDIR/layer-metadata/all.json"`
+else
+ # Validate layers in wv.json with a JSON schema
+ `node $SCRIPTS_DIR/validateConfigs.js \
+ --inputDirectory "$SRC_DIR/common/config/wv.json/layers" \
+ --schemaFile "$BASE/schemas/layer-config.json"`
+
+ if [ -e "$BUILD_DIR/features.json" ] ; then
+ cp "$BUILD_DIR/features.json" "$BUILD_DIR/config/wv.json/_features.json"
+ fi
+
+ # Run extractConfigFromWMTS.js script with config.json
+ if [ -e "$BUILD_DIR/config.json" ] ; then
+ `node $SCRIPTS_DIR/extractConfigFromWMTS.js \
+ --config "$BUILD_DIR/config.json" \
+ --inputDir "$BUILD_DIR/gc" \
+ --outputDir "$BUILD_DIR/_wmts"`
+ fi
+
+ # Run processVectorStyles.js and move vectorstyles where we want them
+ if [ -e "$BUILD_DIR/gc/vectorstyles" ] ; then
+ mkdir -p "$BUILD_DIR/config/wv.json/vectorstyles"
+ `node $SCRIPTS_DIR/processVectorStyles.js \
+ --inputDir "$BUILD_DIR/gc/vectorstyles" \
+ --outputDir "$BUILD_DIR/config/wv.json/vectorstyles"`
+ fi
+
+ # Run processVectorData.js and move vectordata where we want them
+ if [ -e "$BUILD_DIR/gc/vectordata" ] ; then
+ mkdir -p "$BUILD_DIR/config/wv.json/vectordata"
+ `node $SCRIPTS_DIR/processVectorData.js \
+ --inputDir "$BUILD_DIR/gc/vectordata" \
+ --outputDir "$BUILD_DIR/config/wv.json/vectordata"`
+ fi
+
+ # Run processColormap.js and move colormaps where we want them
+ if [ -e "$BUILD_DIR/colormaps" ] ; then
+ mkdir -p "$BUILD_DIR"/config/palettes
+ if [ -d "$BUILD_DIR"/gc/colormaps ] ; then
+ cp -r "$BUILD_DIR"/gc/colormaps "$BUILD_DIR"/colormaps/gc
+ fi
+ `node $SCRIPTS_DIR/processColormap.js \
+ --config "$OPT_DIR/$OPT_SUBDIR/config.json" \
+ --inputDir "$BUILD_DIR/colormaps" \
+ --outputDir "$BUILD_DIR/config/palettes"`
+ fi
+
+ # Throw error if no categoryGroupOrder.json file present
+ if [ ! -e "$BUILD_DIR/config/wv.json/categoryGroupOrder.json" ] ; then
+ echo "categoryGroupOrder.json not found. Generating..."
+ `node $SCRIPTS_DIR/generateCategoryGroupOrder.js \
+ --inputDir "$SRC_DIR/common/config/wv.json/categories/" \
+ --outputDir "$SRC_DIR/common/config/wv.json/"`
+ fi
+
+ if [ -e "$OPT_DIR/$OPT_SUBDIR/layer-metadata/all.json" ] ; then
+ cp "$OPT_DIR/$OPT_SUBDIR/layer-metadata/all.json" "$BUILD_DIR/config/wv.json/layer-metadata.json"
+ fi
+
+ # Run mergeConfig.js on each directory in /config containing .json files
+ # This creates on palettes-custom.json and wv.json
+ configs=$(ls "$BUILD_DIR/config")
+ for config in $configs; do
+ case $config in
+ *.json)
+ bash -c "node $SCRIPTS_DIR/mergeConfig.js \
+ --inputDir '$BUILD_DIR/config/$config' \
+ --outputFile '$DEST_DIR/config/$config'"
+ ;;
+ *)
+ cp -r "$BUILD_DIR/config/$config" "$DEST_DIR/config/$config"
+ ;;
+ esac
+ done
+
+ # Run mergeConfigWithWMTS.js to merge layer metadata from WMTS GC with worldview layer configs into wv.json
+ `node $SCRIPTS_DIR/mergeConfigWithWMTS.js \
+ --inputDir "$BUILD_DIR/_wmts" \
+ --outputFile "$DEST_DIR/config/wv.json"`
+
+ # Copy brand files from build to dest
+ cp -r "$BUILD_DIR/brand" "$DEST_DIR"
+ cp "$BUILD_DIR/brand.json" "$DEST_DIR"
+
+
+ # Validate the options build
+ `node $SCRIPTS_DIR/validateOptions.js \
+ --optionsFile "$BUILD_DIR/config.json" \
+ --configDir "$DEST_DIR/config"`
# Fetch preview images from WV Snapshots for any layers which they are missing
`node $SCRIPTS_DIR/fetchPreviewSnapshots.js \
--wvJsonFile "$DEST_DIR/config/wv.json" \
--overridesFile "$OPT_DIR/common/previewLayerOverrides.json" \
--featuresFile "$BUILD_DIR/features.json"`
-# fi
+fi
exit 0
diff --git a/tasks/util/dist.js b/tasks/util/dist.js
index 594107232..c4ce8b103 100755
--- a/tasks/util/dist.js
+++ b/tasks/util/dist.js
@@ -21,7 +21,7 @@ if (!features.previewSnapshots) {
console.log('Branding')
// eslint-disable-next-line n/no-missing-require
-const brand = require('../build/worldview/brand/brand.json')
+const brand = require('../../build/worldview/brand/brand.json')
const applyTo = [
'build/worldview/index.html',
diff --git a/tasks/util/start.js b/tasks/util/start.js
index 09d7eee00..d17af8d6f 100755
--- a/tasks/util/start.js
+++ b/tasks/util/start.js
@@ -7,7 +7,6 @@ const port = process.env.PORT || 3000
const app = express()
app.use(compression())
app.use(express.static(path.join(__dirname, '../../web')))
-// app.use('/test', express.static(path.join(__dirname, '../build/worldview'))); // test dist in a "test" sub directory
app.set('port', port)
app.listen(port, () => {
console.log(`Worldview is available at http://localhost:${port}`)