https://github.com/aquaveo/backlayer
Backend-driven approach to render Open layers.
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.4%) to scientific vocabulary
Repository
Backend-driven approach to render Open layers.
Basic Info
- Host: GitHub
- Owner: Aquaveo
- Language: JavaScript
- Default Branch: main
- Size: 1.97 MB
Statistics
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
[//]: <> (start placeholder for auto-badger)
:heart: to auto badger for making badging simple
Backlayer
The BackLayer (Open Layer Components Backend Driven) is a POC package that allows to build npm components dynamically, based on dictionaries taht are send through a backend engine. This package is used to help with the creation of Tethys plugins, so the backend part of the plugin (usually an intake driver) can reference a react UI component(which will use the backlayer package if any Open Layers capability is needed)
Prerequisites
This project requires NodeJS (version 8 or later) and NPM. Node and NPM are really easy to install. You can install the Node Version Manager and Node.js:
a. Install Node Version Manager (nvm) b. CLOSE ALL OF YOUR TERMINALS AND OPEN NEW ONES c. Use NVM to install Node.js 20
sh
$ nvm install 20
$ nvm use 20
$ npm -v && node -v
Table of contents
Getting Started
Installation
BEFORE YOU INSTALL: please read the prerequisites
Start with cloning this repo on your local machine:
sh
$ git clone https://github.com/Aquaveo/backlayer.git
$ cd backlayer
To install and set up the library, run:
sh
$ npm install -S backlayer
Or if you prefer using Yarn:
sh
$ yarn add --dev backlayer
Building a distribution version
sh
$ npm run build
This task will create a distribution version of the project inside your local dist/ folder. The package uses Webpack to bundle the package
Components.
The backlayer package contains the following components:
Map-> Component that representsol/Mapthat wraps the other different other componentsView-> Component representingol/viewthat takes a dictionary with the args thatol/viewtakes.Layer-> Component that consumes from an object to make any type of layer available inolLayers-> Wrapper for the differentLayercomponentsControls-> Wrapper for the differentControlcomponentsLegendControl-> Component that creates a Legend given an objectLayersControl-> Component that creates a layer switch component.Overlays-> Wrapper for the differentOverlaycomponentsOverLay-> Component forol/overlaythat takes an object with the args required byol/overlay
Example:
```js import React, { memo } from 'react';
import { Map, View, Layer, Layers, Controls, LegendControl, LayersControl, Overlays, OverLay, } from 'backlayer';
import { DemoLayers, DemoViewConfig, DemoMapConfig, DemoLegend, DemoOverlays, } from 'backlayer/demo';
const MapComponent = ({ mapConfig = DemoMapConfig, viewConfig = DemoViewConfig, layers = DemoLayers, legend = DemoLegend, overlays = DemoOverlays, }) => { return ( ); };
export default memo(MapComponent); ```
Map
Example:
```js import { Map } from 'backlayer';
const demoMapConfig = { className: 'ol-map', style: { width: '100%', height: '100vh', }, }; ; ```
Please note that both the classname and style needs to be provided.
View
Example:
```js import { View } from 'backlayer';
const demoViewConfig = { center: fromLonLat([-110.875, 37.345]), zoom: 5, };
Please note that demoViewConfig can contain any option listed here
Layer
Example:
```js import { Layers, Layer } from 'backlayer';
const DemoLayers = [ { type: 'WebGLTile', props: { source: { type: 'ImageTile', props: { url: 'https://server.arcgisonline.com/arcgis/rest/services/Canvas/WorldDarkGrayBase/MapServer/tile/{z}/{y}/{x}', attributions: 'Tiles © <a href="https://server.arcgisonline.com/arcgis/rest/services/Canvas/WorldDarkGrayBase/MapServer">ArcGIS', }, }, name: 'World Dark Gray Base Base Map', zIndex: 0, }, }, { type: 'ImageLayer', props: { source: { type: 'ImageArcGISRest', props: { url: 'https://mapservices.weather.noaa.gov/eventdriven/rest/services/water/rivgauges/MapServer', params: { LAYERS: 'show:0', layerDefs: JSON.stringify({ 0: "status = 'action' or status='minor' or status='moderate' or status='major'", }), }, }, }, name: 'Flooding River Gauges', zIndex: 1, }, }, { type: 'VectorLayer', props: { source: { type: 'Vector', props: { url: 'https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/ParksandOpenSpace/FeatureServer/0/query?where=1%3D1&outFields=*&returnGeometry=true&f=geojson', format: { type: 'GeoJSON', props: {}, }, }, }, style: { type: 'Style', props: { stroke: { type: 'Stroke', props: { color: '#501020', width: 1, }, }, }, }, name: 'rfc max forecast (Decreasing Forecast Trend)', zIndex: 2, }, }, ];
Please note that the object used to generate the different layers. follows the same structure:
type: the association to theoltype. This can be found here:
js
const typeMapping = {
// Map type strings to module paths
WebGLTile: 'ol/layer/WebGLTile.js',
ImageLayer: 'ol/layer/Image.js',
VectorLayer: 'ol/layer/Vector.js',
ImageTile: 'ol/source/ImageTile.js',
ImageArcGISRest: 'ol/source/ImageArcGISRest.js',
Vector: 'ol/source/Vector.js',
GeoJSON: 'ol/format/GeoJSON.js',
Style: 'ol/style/Style.js',
Stroke: 'ol/style/Stroke.js',
Fill: 'ol/style/Fill.js',
// Add other mappings as needed
};
props: the different options that theoltype (e.g.ol/layer/Image,ol/layer/Vector) will need: Please note that the props can have a nested structure, and do not limit to only, layers, but they can be sources, styles, etc
Please look at the example
LegendControl
Example:
```js import { Controls, LegendControl } from 'backlayer';
const demoLegend = [ { label: 'Major Flood', color: '#cc33ff', }, { label: 'Moderate Flood', color: '#ff0000', }, { label: 'Minor Flood', color: '#ff9900', }, { label: 'Action', color: '#ffff00', }, { label: 'No Flood', color: '#00ff00', }, { label: 'Flood Category Not Defined', color: '#72afe9', }, { label: 'Low Water Threshold', color: '#906320', }, { label: 'Data Not Current', color: '#bdc2bb', }, { label: 'Out of Service', color: '#666666', }, ];
Please note the structure of the props object for items
LayersControl
Example:
```js import { Controls, LayersControl } from 'backlayer';
OverLay
Example:
```js import { Overlays, OverLay } from 'backlayer';
const demoOverlays = [ { divid: "overlay-1", divclass: "modal-overlay", autoPan: { animation: { duration: 250, }, }, } ]
Please note that the props object contains two attributes div_id and div_class that are used for the id and class of the div container of the overlay
Sample Data
You can use the following for demo data.
js
import {
DemoLayers,
DemoViewConfig,
DemoMapConfig,
DemoLegend,
DemoOverlays,
} from 'backlayer/demo';
Authors
- Aquaveo LLC
License
MIT License
Owner
- Name: Aquaveo
- Login: Aquaveo
- Kind: organization
- Email: it@aquaveo.com
- Location: Provo
- Website: aquaveo.com
- Repositories: 38
- Profile: https://github.com/Aquaveo
GitHub Events
Total
- Push event: 10
- Create event: 2
Last Year
- Push event: 10
- Create event: 2
Packages
- Total packages: 1
-
Total downloads:
- npm 2 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 4
- Total maintainers: 1
npmjs.org: backlayer
Backend-driven approach to render Open layers.
- Homepage: https://github.com/Aquaveo/backlayer#readme
- License: MIT
-
Latest release: 0.0.4
published over 1 year ago
Rankings
Maintainers (1)
Dependencies
- 661 dependencies
- babel-cli ^6.26.0 development
- babel-core ^6.26.3 development
- babel-loader ^9.2.1 development
- babel-plugin-transform-object-rest-spread ^6.26.0 development
- babel-plugin-transform-react-jsx ^6.24.1 development
- babel-preset-env ^1.7.0 development
- css-loader ^7.1.2 development
- style-loader ^4.0.0 development
- webpack-cli ^5.1.4 development
- - ^0.0.1
- @babel/preset-env ^7.26.0
- @babel/preset-react ^7.25.9
- @rollup/plugin-babel ^6.0.4
- @rollup/plugin-commonjs ^28.0.1
- @rollup/plugin-node-resolve ^15.3.0
- ol ^10.2.1
- react ^18.3.1
- react-icons ^5.3.0
- rollup ^4.24.2
- rollup-plugin-postcss ^4.0.2
- save-dev ^0.0.1-security
- styled-components ^6.1.13
- webpack ^5.95.0