Methods

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

Bind multiple move listeners with the same callback
Parameters:
Name Type Attributes 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
thisObj Object <optional>
The object to use as `this` in the event listeners.
Since:
  • 0.2.0

View Source Popup/utils.js, line 24

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 262

- 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 146

Coordinates used to update the map
Array

# connectToMap(component) → {Component}

A wrapper utility function designed to automatically pass down an ol.Map from the top-level Map component
Parameters:
Name Type Description
component Component A React component you want wrapped
Since:
  • 0.1.0

View Source Map/utils.js, line 57

A wrapped React component which will automatically be passed a reference to the ol.Map
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

# 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 26

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 163

https://openlayers.org/en/v4.6.5/apidoc/ol.interaction.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 64

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 166

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

# 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 48

# 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 309

A filtered attribute object
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 116

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 93

The url that is set within the function
String