ol-ishare/map

Create OpenLayers Map, View, Layer etc. instances based on an iShare profile.

ESM example:

import * as imap from 'ol-ishare/map'

// All functions in the info module are accessible as properties of an `imap` Object
let lyr = imap.createVectorLayer(profile, layerName);

Global example:

// All functions in the map module are accessible as properties of `oli.map`
var lyr = oli.map.createVectorLayer(profile, layerName);

Methods

(inner) createGroup(profile, guid) → {ol/layer/Group~LayerGroup}

Creates an ol/layer/Group~LayerGroup instance for the iShare layer group found in profile with the specified GUID

import { createGroup } from 'ol-ishare/map';
Parameters:
Name Type Description
profile module:ol-ishare/profile~Profile

iShare profile

guid String

GUID of the layer group to create

Returns:

Group instance

Type
ol/layer/Group~LayerGroup

(inner) createImageLayer(profile, layerName) → {ol/layer/Image~Image}

Create a WMS image layer

import { createImageLayer } from 'ol-ishare/map';
Parameters:
Name Type Description
profile module:ol-ishare/profile~Profile

iShare profile

layerName String

The name of the layer to create

Returns:

Newly created WMS layer

Type
ol/layer/Image~Image

(inner) createVectorLayer(profile, layerName) → {ol/layer/Vector~Vector}

Create a WFS vector layer

import { createVectorLayer } from 'ol-ishare/map';
Parameters:
Name Type Description
profile module:ol-ishare/profile~Profile

iShare profile

layerName String

The name of the layer to create

Returns:

Newly created WFS layer

Type
ol/layer/Vector~Vector

(inner) createBaseLayer(profile, layerName) → {ol/layer/Tile}

Create a tiled WMS base layer

import { createBaseLayer } from 'ol-ishare/map';
Parameters:
Name Type Description
profile module:ol-ishare/profile~Profile

iShare profile

layerName String

The name of the base layer to create

Returns:

Base map layer

Type
ol/layer/Tile

(inner) createBaseGroup(profile) → {ol/layer/Group~LayerGroup}

Creates a group of tiled WMS base layers

import { createBaseGroup } from 'ol-ishare/map';
Parameters:
Name Type Description
profile module:ol-ishare/profile~Profile

iShare profile

Returns:

Base map layer group

Type
ol/layer/Group~LayerGroup

(inner) createGroupsAndOverlays(profile, onlyVisibleopt, useProfileLayerOrderopt) → {Array.<ol/layer/Group~LayerGroup>}

Create an Array of ol/layer/Group~LayerGroup for a profile each containing one or more layers

import { createGroupsAndOverlays } from 'ol-ishare/map';
Parameters:
Name Type Attributes Default Description
profile module:ol-ishare/profile~Profile

iShare profile returned by module:ol-ishare/profile#getProfile

onlyVisible Boolean <optional>
true

If true only create initiallyVisible layers and their groups

useProfileLayerOrder Boolean <optional>
false

If true add layers in reverse order

  • means that the first listed will be at the top (for a given z-index)
Returns:

A list of groups which contain the newly created layers

Type
Array.<ol/layer/Group~LayerGroup>

(inner) createView(profile, mapSize, useInitialopt) → {ol/View~View}

Creates an ol/View~View instance for a given profile and mapSize. Configures the projection, resolutions, initial centre and zoom. The profile.view properties such as easting, northing and zoom can be overridden to affect the initial view. If a profile.view.resolution is defined it will take precidence over the zoom property.

import { createView } from 'ol-ishare/map';
Parameters:
Name Type Attributes Default Description
profile module:ol-ishare/profile~Profile

iShare profile

mapSize ol/size~Size

Width and height of the map as returned by ol/PluggableMap~PluggableMap#getSize

useInitial Boolean <optional>
false

If true then starts with the current view set in the profile, otherwise uses .initialView

Returns:

OpenLayers View instance

Type
ol/View~View

(inner) createMap(target, ol_opts) → {ol/Map~Map}

Create an OpenLayers Map instance

import { createMap } from 'ol-ishare/map';
Parameters:
Name Type Description
target String

DOM element that the map will be created within

ol_opts ol/PluggableMap~MapOptions

OpenLayers Map Options

Returns:

map Map instance

Type
ol/Map~Map