$paddleObj = new PaddlingArea($pdArea);
                    $regionObj->areas[] = $paddleObj;
                }
                $regionObjArray[] = $regionObj;
                file_put_contents(__DIR__ . DS . 'regions.json', json_encode($regionObjArray, JSON_PRETTY_PRINT));
            }
        } else {
            $regionObjArray = json_decode(file_get_contents(__DIR__ . DS . 'regions.json'));
        }
        if (empty($regionObjArray)) {
            throw new Exception('There were no regions');
        }
        // HtmlBock is used to seperate templates from code
        // look in scaffolds/html.form.select.php
        HtmlBlock('form.select', array('regions' => $regionObjArray, 'layers' => array_map(function ($layer) {
            return array('id' => $layer->getId(), 'name' => $layer->getName());
        }, GeoliveHelper::VisibleLayers()), 'url' => UrlFrom(__FILE__)), __DIR__ . DS . 'scaffolds');
        if (false && Core::Client()->isAdmin()) {
            // disabled
            // link to test for admin
            ?>
<a href="<?php 
            echo UrlFrom(__FILE__);
            ?>
?task=unit_test">run
	unit tests</a><?php 
        }
    } else {
        throw new Exception("Unrecognized Execution Environment");
    }
} catch (Exception $e) {
<?php

/**
 * This is the access point for displaying the map, paddlingArea, selection tool
 */
try {
    include_once __DIR__ . '/lib/GeoliveHelper.php';
    error_reporting(E_ALL ^ E_NOTICE);
    // report everything except notices
    ini_set('display_errors', 1);
    ini_set('log_errors', 1);
    ini_set('error_log', '../logs/siteSearch.log');
    if (GeoliveHelper::ScriptWasAccessedDirectlyFromUrl()) {
        HtmlBlock('paddlingareas.map', array(), __DIR__ . DS . 'scaffolds');
    } else {
        throw new Exception("Unrecognized Execution Environment");
    }
} catch (Exception $e) {
    die(print_r($e, true));
}