Skip to main content

LAND IT Front-end Extensions SDK

This API can be used by the front-end modules of an extension (Custom UI modules) to interact with the LAND IT front-end application and retrieve data such as context data (details about the current scenario and version where the module is being executed/displayed), available layers and geometries.

These methods are async (return Promises), since the postMessage() method is used for communication between the extension IFrame and the main application.


getProps()​

Get context "props" for the extension component (scenarioId and versionId).

Example response
{
"scenarioId": 1,
"versionId": 2
}

getScenarioVersion()​

Get details of the current scenario and version.

Example response
{
"scenarioId": 3,
"version": 1,
"title": "Test - Cardigos",
"description": "Imported scenario for testing",
"versionName": "First Version",
"versionDescription": "This is the first version",
"aigp": "Cardigos",
"parentVersion": null,
"isOwner": true,
}

getLayers()​

Get information about the existing layers on the current scenario version.

Example response
[
{
"name": "POSP",
"description": "...",
"scenarioId": 1,
"versionId": 2,
"id": 21,
"visible": true,
"selected": 0,
"type": "ScenarioPOSP",
"geometryType": "POLYGONS",
"renderer": {...}
},
{
...
}
]

getLayersOfType(layerType: string)​

Get information about the layers of a specific type on the current scenario version.

  • Parameters:
    • layerType — type of layer. Examples: "ScenarioPOSP", "ScenarioIS", "ScenarioES", "POSA", "Edit"
Example response

layerType = "ScenarioPOSP"

[
{
"name": "POSP",
"description": "...",
"scenarioId": 1,
"versionId": 2,
"id": 21,
"visible": true,
"selected": 0,
"type": "ScenarioPOSP",
"geometryType": "POLYGONS",
"renderer": {...}
}
]

getLayersGeometries()​

Get geometries of all layers on the current scenario version.

Example response
[
{
"layer": 21,
"geoms": [
{
"id": 1000,
"geojson": "...",
"geomType": "POLYGONS",
"area": 731.8,
"perimeter": 195.8,
"attributes": [...]
},
...
]
},
{
...
}
]

getGeometriesByLayer(layerType: string)​

Get geometries of layers of a specific type on the current scenario version.

  • Parameters:
    • layerType — type of layer. Examples: "ScenarioPOSP", "ScenarioIS", "ScenarioES", "POSA", "Edit"
Example response

layerType = "ScenarioPOSP"

[
[
{
"id": 1000,
"geojson": "...",
"geomType": "POLYGONS",
"area": 731.8,
"perimeter": 195.8,
"attributes": [...]
},
...
]
]

executeFunctionModule(extension: string, module: string, input: any, fileOutput: boolean = false)​

Execute an extension function module (in the back-end) and retrieve its result.

  • Parameters:
    • extension — id of the extension
    • module — id of the module to execute
    • input — input to pass to the function module
    • fileOutput — true if the module returns a (binary) file, false if it returns json

showToast(message: string, type: string)​

Display a toast message

  • Parameters:
    • message — the text to display on the toast
    • type — the type of toast. Accepted values: 'info' | 'success' | 'warning' | 'error' | 'default'

notifyChange(resourceType: string)​

Notify the front-end application of a change in a resource, so that the page can be updated accordingly.

  • Parameters:
    • resourceType — the type of resource that was updated. Accepted values: 'filters' (for now, only this is available)