This document provides detailed insights into the structure, functionality, and usage of the JavaScript files comprising the Salmon Habitat Restoration Projects Visualization. Leveraging Leaflet for mapping, AmCharts for chart visualization, and DataTable for managing tabular data, this project offers a comprehensive platform for exploring salmon habitat restoration initiatives.
This HTML file serves as the project's main entry point, incorporating essential libraries and scripts for rendering functionalities.
This HTML file serves as the project's main entry point, similar to restoration.html
, but it is themed with GC Web. It incorporates essential libraries and scripts for rendering functionalities while adhering to the styling and design guidelines provided by GC Web.
The CSS file contains minimal styles tailored not to interfere with existing web page styles. This approach ensures compatibility and seamless integration when placed into a placeholder within an existing web page. The design focuses on basic layout and functionality, avoiding any style overrides that could conflict with the GC Web styles.
The global.js
file contains essential global variables and configurations required for initializing and managing the habitat restoration data visualization project.
Variables | Purpose |
---|---|
dataset |
Object defining the structure and configuration for the salmon habitat restoration project dataset. |
selectors |
Configures dropdown selectors for filtering habitat restoration projects based on various criteria. |
geojsonLayers geojsonSMULayers |
Defines GeoJSON layers for displaying habitat restoration project boundaries on the map. |
Repository for commonly used utility functions facilitating data processing and manipulation throughout the project.
Functions responsible for fetching and processing data required for project visualization.
Functions for creating and managing chart visualizations within the project.
Functions for initializing and managing interactive map visualization.
Functions for initializing and managing data tables within the project.
Main script orchestrating the project logic, integrating functionalities from other JavaScript files.
Module for managing data storage and retrieval using IndexedDB, providing data handling for the project.
The data files are placed under public/restoration/data/
. If you do not find this folder, please create it and download all necessary CSV and JSON files to place into the folder.
- Folder: Pacific Salmon Strategy Initiative - 04 - Salmon Habitat Restoration Projects - All Documents (sharepoint.com)
- File:
Salmon_Habitat_Restoration_Projects_Final.csv
- Schema: The CSV file schema maps dataset columns to descriptive aliases used throughout the project.
- Folder: Pacific Salmon Strategy Initiative - GeoJSON_CU_SMU_TestingOnly_20240605 - All Documents (sharepoint.com)
- Files: There are 14 GeoJSON layers, 7 CU layers, and 7 SMU layers.
- CU Layers:
CK_CU_Simp100.geojson
CM_CU_Simp100.geojson
- ...
- SMU Layers:
CK_SMU_Simp100.geojson
CM_SMU_Simp100.geojson
- ...
- CU Layers:
These files are integral to the project and are referenced as the major values for the variables geojsonLayers
and geojsonSMULayers
in the global.js
file.
- The project is designed to run on Node.js version 20.
- It utilizes Express.js for backend routing.
The complete source code for this project is available on GitHub, repo name is data-portal-habitat-restoration
: dfo-mpo/data-portal-habitat-restoration
- The
ref/
folder in the repository contains files for the GitHub-hosted static website (legacy) used only for reference. It is not required to run the main application and serves purely for demonstration purposes.
- Ensure that all necessary files, including HTML, CSS, data files, and JavaScript files, are properly linked and accessible within the project environment.
- To install node modules, run
npm install
. - To launch the project, run the command
node app.js
in the terminal. - To preview in Azure Web App, Salmon Habitat Restoration Projects
For a reference implementation on how the visualization should look when integrated into a styled web page, refer to the following page: Salmon Habitat Restoration Projects with GC Web Theme.
Upon loading the dashboard, you will be presented with various interactive components, including:
- A map displaying salmon habitat restoration project boundaries.
- Charts showcasing key project metrics.
- Data tables providing information on salmon habitat restoration projects.