Methods

# addMovementListener(map, callback) → {Array.<ol.EventsKey>}

Bind multiple move listeners with the same callback
Parameters:
Name Type Description
map ol.Map The openlayers map to which the events are bound
callback function The callback invoked when a `change:size`, `change:resolution` or a `change:center` event was fired
Since:
  • 0.2.0

View Source Popup/utils.js, line 22

Array of openlayers event keys for unsetting listener events (use with removeMovementListener)
Array.<ol.EventsKey>

# calculateViewPadding(map, opts) → {Array}

Calculate bounding box of elements on page with _popup_boundary class and returns padding array excluding area of these elements
Parameters:
Name Type Description
map olMap An instance of an openlayers map
opts Object

View Source Popup/utils.js, line 273

- Array of view padding pixel numbers: [top, right, bottom, left]
Array

# centerAndZoom(map, opts) → {Array}

Update the map location to provided zoom & x, y coordinates
Parameters:
Name Type Description
map ol.Map reference to the openlayer map object
opts Object include x, y, & zoom options
Since:
  • 0.1.0

View Source Map/utils.js, line 110

Coordinates used to update the map
Array

# connectToContext(component) → {Component}

A wrapper utility function designed to automatically pass down provider conntext as props from the Provider component
Parameters:
Name Type Description
component Component A React component you want wrapped
Since:
  • 1.0.0

View Source Provider/utils.js, line 13

A wrapped React component which will automatically be passed a reference to provider context
Component

# convertFeatureToWkt(feature, decimalPlacesopt) → {String}

Convert a feature to a WKT string
Parameters:
Name Type Attributes Description
feature Object An ol/Feature
decimalPlaces Number <optional>
the number of decimal places in the output coordinates

View Source Popup/PopupActions/PopupActionCopyWkt/utils.js, line 11

The WKT string of the feature passed
String

# convertXYtoLatLong(map, x, y) → {Object}

Convert an XY pair to lat/long
Parameters:
Name Type Description
map ol.Map reference to the openlayer map object
x Number the x coordinate
y Number the x coordinate
Since:
  • 0.16.0

View Source Map/utils.js, line 130

An object containing a `longitude` and `latitude` property
Object

# copyTextToClipboard(text)

Copy text to the clipboard
Parameters:
Name Type Description
text String The string to copy to the system clipboard

View Source Popup/PopupActions/PopupActionCopyWkt/utils.js, line 26

# copyWktToClipbard(feature, decimalPlacesopt)

Given an ol/Feature, copy its WKT string to the system clipboard
Parameters:
Name Type Attributes Description
feature Object An ol/Feature
decimalPlaces Number <optional>
the number of decimal places in the output coordinates

View Source Popup/PopupActions/PopupActionCopyWkt/utils.js, line 42

# createMap(optsopt) → {ol.Map}

Create an openlayers map
Parameters:
Name Type Attributes Description
opts Object <optional>
Object of optional params
target String <optional>
htm id tag that map will into which the map will render
Since:
  • 0.1.0

View Source Map/utils.js, line 24

A newly constructed ol.Map
ol.Map

# createSelectInteraction() → {ol.interaction.Select}

Create a new openlayers select interaction with default styling
Since:
  • 0.2.0

View Source Map/utils.js, line 149

https://openlayers.org/en/latest/apidoc/module-ol_interaction_Select-Select.html
ol.interaction.Select

# exportFeatures(typeopt, featuresopt)

Exports the passed features as a file of the desired type.
Parameters:
Name Type Attributes Description
type String <optional>
The desired file type ('shp' or 'kml').
features Array.<Object> <optional>
An array of the features to be included in the generated file.
Since:
  • 0.9.0

View Source LayerPanel/LayerPanelActionExport/utils.js, line 34

# getLayersAndFeaturesForEvent(event, optsopt) → {Array.<Promise>}

Get all features for a given click event
Parameters:
Name Type Attributes Default Description
event Object An object with an `event` and `pixel` property
map ol.Map The openlayers map where the layer exists
pixel Array.<Number> An array consisting of `x` and `y` pixel locations
opts Object <optional>
Object of optional params
hitTolerance Number <optional>
3 Additional area around features that is clickable to select them
Since:
  • 0.2.0

View Source Popup/utils.js, line 62

An array of promises, each of which resolve to an object `{ layer, features }`
Array.<Promise>

# getPopupPositionFromFeatures(event, features, optsopt) → {Object}

Get the best position for the popup to be displayed given features
Parameters:
Name Type Attributes Default Description
event Object An object with an `event` and `pixel` property
map ol.Map The openlayers map where the layer exists
pixel Array.<Number> An array consisting of `x` and `y` pixel locations
features Array.<ol.Feature> An array of features around which the popup should position
opts Object <optional>
popupHeight Number <optional>
280 The height of the popup
popupWidth Number <optional>
280 The width of the popup
arrowHeight Number <optional>
16 The height of the popup's arrow/pointer
navbarOffset Number <optional>
55 The height of the navbar
viewPadding Array.<Number> <optional>
[0, 0, 0, 0] An array of padding to apply to the best fit logic in top, right, bottom, left order

View Source Popup/utils.js, line 187

An object containing the arrow/pointer position, pixel location & if the popup will fit properly within the viewport
Object

# getStyledFeatures(layers, resolutionopt)

Generate a 2D array of features paired to a style representing how they are currently styled on the map. OpenLayers Features will inherit the style set on their parent layer if their own style is undefined. This Function helps resolve the style that is actually being used to render the feature on the map.
Parameters:
Name Type Attributes Description
layers Array.<Object> The Openlayers Layers you want to get the features from.
resolution Number <optional>
The map's current resolution.

View Source Draw/utils.js, line 398

# loadDataLayer(map, query, optsopt) → {ol.Layer}

Async fetch for data layers - supports geojson, kml
Parameters:
Name Type Attributes Description
map ol.Map reference to the openlayer map object
query String url string pointing to geojson/kml file or the geojson/kml file itself
opts Object <optional>
Object of optional params
addToMap Boolean <optional>
opt out of adding the layer to the map (default true)
style String <optional>
style object used to apply styles to the layer
Since:
  • 0.8.0

View Source DataLayers/utils.js, line 55

Promise that resolves with the newly created data layer
ol.Layer

# removeMovementListener(map, keys)

Remove list of event keys
Parameters:
Name Type Description
map ol.Map The openlayers map to which the events are bound
keys Array remove the listeners via an array of event keys
Since:
  • 0.2.0

View Source Popup/utils.js, line 46

# sanitizeProperties(properties) → {Object}

Remove blacklisted attributes (geom & geometry & _ol_kit*) from an object
Parameters:
Name Type Description
properties Object A feature attribute object
Since:
  • 0.11.0

View Source Popup/utils.js, line 320

A filtered attribute object
Object

# styleText(opts, feature, resolution, opts) → {object}

Style ol/features
Parameters:
Name Type Description
opts object The config object
feature ol/Feature The feature you want to style
resolution number the resolution of the map
opts object The config object

View Source Draw/utils.js, line 519

The style object for the passed feature
object

# updateMapFromUrl(map, viewParam) → {Promise}

Update the map view with location coordinates, zoom level & rotation from the url
Parameters:
Name Type Description
map ol.Map reference to the openlayer map object
viewParam String the query param that will be read to update the map position
Since:
  • 0.1.0

View Source Map/utils.js, line 80

Resolved with transformed center coords after the map has been updated by url info
Promise

# updateUrlFromMap(map, viewParam) → {String}

Update the url with map location coordinates, zoom level & rotation
Parameters:
Name Type Description
map ol.Map reference to the openlayer map object
viewParam String the query param that will be used to update the url with view info
Since:
  • 0.1.0

View Source Map/utils.js, line 57

The url that is set within the function
String