8.1.0 • Published 2 days ago

@terrestris/shogun-util v8.1.0

Weekly downloads
-
License
BSD-2-Clause
Repository
github
Last release
2 days ago

SHOGun-Util

Connect to a SHOGun instance with ease.

Installation

npm i @terrestris/shogun-util

Usage

This package contains two core classes:

  • SHOGunAPIClient: Provides access to the HTTP API endpoints of SHOGun.
  • SHOGunApplicationUtil: A set of helper functions to parse SHOGun entities into JavaScript/OpenLayers instances.

See the following example to get an idea on how the classes can be utilized:

import Keycloak from 'keycloak-js';

import Map from 'ol/Map';

import SHOGunApplicationUtil from '@terrestris/shogun-util/dist/parser/SHOGunApplicationUtil';
import SHOGunAPIClient from '@terrestris/shogun-util/dist/service/SHOGunAPIClient';

// Create the (optional) Keycloak connector. This is required if bearer token authentication
// is needed inside you project setup only.
const keycloak = new Keycloak({
  url: 'https://localhost/auth',
  realm: 'SHOGunRealm',
  clientId: 'SHOGunClient'
});

// Initialize the keycloak client.
keycloak.init({
  onLoad: 'check-sso'
});

// Create the client to easily connect to a SHOGun instance, e.g. to get an
// application configuration.
const client = new SHOGunAPIClient({
  // The path to SHOGun.
  url: '/api',
  // The (optional) keycloak connector.
  keycloak: keycloak
});

// Create the parser to transform SHOGun entities into OpenLayers instances.
const parser = new SHOGunApplicationUtil({
  client
});

// Get the application with ID 1909.
const application = await client.application().findOne(1909);

// Get the map view.
const view = await parser.parseMapView(application);
// Parse the layers.
const layers = await parser.parseLayerTree(application);

// And build the map.
const map = new Map({
  view,
  layers
});

Development

npm run watch:buildto can be used to inject an updated version of shogun-util into another project. The script will also watch for further changes.

npm run watch:buildto ../shogun-gis-client/node_modules/@terrestris/shogun-util/
7.2.0-ol7.3

2 days ago

8.1.0

4 days ago

7.2.0-ol7.2

4 days ago

7.1.1-ol7.1

9 days ago

7.2.0-ol7.1

9 days ago

7.3.2

10 days ago

8.0.1

10 days ago

8.0.0

18 days ago

7.1.1

4 months ago

7.3.1

4 months ago

6.1.0

10 months ago

7.3.0

7 months ago

7.1.0

9 months ago

6.0.1

10 months ago

6.0.0

10 months ago

7.0.0

10 months ago

7.2.0

8 months ago

7.0.1

10 months ago

5.7.0

10 months ago

5.6.2

10 months ago

5.6.0

10 months ago

5.6.1

10 months ago

5.5.0

11 months ago

5.4.1

11 months ago

5.3.2

12 months ago

5.4.0

11 months ago

5.3.1

12 months ago

5.3.0

1 year ago

5.2.0

1 year ago

5.1.0

1 year ago

5.0.0

1 year ago

4.1.4

1 year ago

4.1.3

1 year ago

4.2.1

1 year ago

4.1.2

1 year ago

4.2.0

1 year ago

3.7.0

2 years ago

4.1.0

1 year ago

4.0.0

1 year ago

4.1.1

1 year ago

3.6.0

2 years ago

3.5.0

2 years ago

3.4.0

2 years ago

3.2.2

2 years ago

3.1.3

2 years ago

1.2.0

2 years ago

3.3.0

2 years ago

3.2.1

2 years ago

3.1.2

2 years ago

1.1.0

2 years ago

3.2.0

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.4.1

2 years ago

3.0.0

2 years ago

1.2.1

2 years ago

2.0.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago