Toggle menu

Geospatial Layer Search Helper

To support the development of geospatial search and import End Points, a layerSearchHelper class has been supplied to provide a series of helper functions.

The layerSearchHelper can be initialised into a variable like this:

// Create a helper object
const helper = this.invokeEP("goss.geospatial.v1.util.layerSearchHelper");

The following functions are provided with the layerSearchHelper:

getLayer

This function retrieves the details of a layer as defined in the Geospatial Layer Manager, only one of name or id should be supplied.

ParameterTypeRequiredNotes
nameStringYes, one of name or idThe name of the layer to retrieve
idStringYes, one of name or idThe ID of the layer to retrieve

getImportData

This function is used to retrieve previously imported data for a layer in a specific search area. Only one of bbox or circle should be supplied.

ParameterTypeRequiredNotes
layerObjectYesA layer object as retrieved by the getLayer function
spatialRelationStringNoThe search spatial relationship, "within" or "intersects", defaults to "within"
bboxObjectYes, one of bbox or circleA bounding import area
circleObjectYes, one of bbox or circleA point and radius circle import area
maxRowsNumberNoThe maximum number of results to return
distanceToObjectNoThe point to which each feature will return it's distance to

importData

This function is used to import geospatial data into the iCM database. Only one of fullGlobe, bbox, or circle should be supplied.

ParameterTypeRequiredNotes
layerObjectYesA layer object as retrieved by the getLayer function
geoJSONObjectYesThe geospatial data to import
fullGlobeBooleanYes, one of fullGlobe, bbox, or circleDoes the import cover the full globe?
bboxObjectYes, one of fullGlobe, bbox, or circleA bounding import area
circleObjectYes, one of fullGlobe, bbox, or circleA point and radius circle import area
spatialRelationStringNoThe spatial relationship, "within" or "intersects", defaults to "within"

generateBoundingCircle

This function can be used to generate a minimum bounding circle which will contain the provided bounding box.

ParameterTypeRequiredNotes
bboxObjectYesThe bounding box to generate a circle around

calculateDistances

This function adds a distance (from the distanceTo point) property to each GeoJSON feature. If invalid geoJSON or distanceTo parameters are provided the original object will be returned unchanged.

ParameterTypeRequiredNotes
geoJSONObjectNoThe features to calculate the distances for
distanceToObjectNoThe point at which each feature will return it's distance to

applyMaxRows

This function reduces the GeoJSON feature collection to the specified max rows. If invalid geoJSON or maxRows parameters are provided the original object will be returned unchanged.

ParameterTypeRequiredNotes
geoJSONObjectNoThe features to reduce
maxRowsNumberNoThe maximum number of features

sortByDistance

This function sorts the supplied GeoJSON by its distance property. If invalid geoJSON is provided the original object will be returned unchanged.

ParameterTypeRequiredNotes
geoJSONObjectNoThe features to sort
Last modified on July 14, 2023

Share this page

Facebook icon Twitter icon email icon

Print

print icon