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.
Parameter | Type | Required | Notes |
---|---|---|---|
name | String | Yes, one of name or id | The name of the layer to retrieve |
id | String | Yes, one of name or id | The 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.
Parameter | Type | Required | Notes |
---|---|---|---|
layer | Object | Yes | A layer object as retrieved by the getLayer function |
spatialRelation | String | No | The search spatial relationship, "within" or "intersects", defaults to "within" |
bbox | Object | Yes, one of bbox or circle | A bounding import area |
circle | Object | Yes, one of bbox or circle | A point and radius circle import area |
maxRows | Number | No | The maximum number of results to return |
distanceTo | Object | No | The 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.
Parameter | Type | Required | Notes |
---|---|---|---|
layer | Object | Yes | A layer object as retrieved by the getLayer function |
geoJSON | Object | Yes | The geospatial data to import |
fullGlobe | Boolean | Yes, one of fullGlobe, bbox, or circle | Does the import cover the full globe? |
bbox | Object | Yes, one of fullGlobe, bbox, or circle | A bounding import area |
circle | Object | Yes, one of fullGlobe, bbox, or circle | A point and radius circle import area |
spatialRelation | String | No | The 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.
Parameter | Type | Required | Notes |
---|---|---|---|
bbox | Object | Yes | The 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.
Parameter | Type | Required | Notes |
---|---|---|---|
geoJSON | Object | No | The features to calculate the distances for |
distanceTo | Object | No | The 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.
Parameter | Type | Required | Notes |
---|---|---|---|
geoJSON | Object | No | The features to reduce |
maxRows | Number | No | The 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.
Parameter | Type | Required | Notes |
---|---|---|---|
geoJSON | Object | No | The features to sort |