Skip to main content

Script reference for App Engine

Everything a script in the App Engine can use without further setup: the map, queries, workflows, files, messages between panels, forms and tables.

POSTED: | UPDATED: | by Stefan Schüttenkopf

A browser app consists of panels that you arrange in the App Engine. A panel can carry a script written in TypeScript. This page lists what such a script can use. It describes version 17.2.

Where a script runs

PanelScriptAvailable in the script
Map ViewyesEverything on this page, including the map
Custom panelyes, together with its own HTML and CSSEverything except the map
RecipesyesEverything except the map
Dashboardno. A dashboard has scripts of its own in its widgets.–
Workflowno–

The editor offers the same suggestions in every panel. A suggestion for window.map in a custom panel does not mean that the map exists there: in a custom panel window.map is undefined.

Names you can use directly

These names exist in every script. You do not import them.

NameWhat it doesSection
window.mapThe map of the panel. Map View only.The map
executeQueryRuns a query that was defined in Studio.Queries
openWorkflowOpens a workflow in a new window.Workflows
getWarehouseFilePublic
getWarehouseFilePrivate
Load a file that you placed on the server.Files from the server
ready, post, listen, listenToMessages between the panels of the app.Messages between panels
FormInstance, TableInstance
QuickSearchAction, FilterAction, SettingsAction
Forms and tables. New in 17.2.Forms and tables
addPointCloudClassificationStyleDefines the classes and colors of a point cloud layer.Point clouds
performQueryDeprecated. Use executeQuery.Queries

Do not declare a function or a constant of your own with one of these names at the top level of your script. The script then fails to start.

Imports

A script can import from LuciadRIA, the map library of the browser app:

import * as ShapeFactory from '@luciad/ria/shape/ShapeFactory';
import { WebGLMap } from '@luciad/ria/view/WebGLMap';

Other imports do not work:

  • Imports from @mui/material, react or other packages make the script fail. JSX does not work either.
  • An import that is only used as a type is harmless, because types are removed before the script runs.

To use another library, load it at run time with a script element. The editor has the snippet Load an external library for this.

The map

In the script of a Map View, window.map is the LuciadRIA map (WebGLMap) with everything LuciadRIA offers: layers, camera, selection, events. In addition it has the object stores with functions of the browser app. The editor has no suggestions for stores.

CallWhat it does
stores.sidebarMenu.addMenuItem(item, openOnAdd)Adds a tab with a panel, or a plain button, to the menu of the app. See below.
stores.overlays.addModelessOverlay(options)Opens a floating window on the map.
stores.overlays.showModalOverlay(options)Opens a window that blocks the app until it is closed. Only one at a time.
stores.mapState.notificationHandler.displayNotification(options)Shows a notification.
stores.copyright.addCopyright(text)Adds a line to the copyright note of the map.
stores.navigationLimits for zoom, rotation and tilt. See the snippet Define navigation restrictions.

A tab in the menu

const panelRoot = document.createElement('div');
panelRoot.textContent = 'Hello';

const tab = window.map.stores.sidebarMenu.addMenuItem({
    id: 'example-panel',
    icon: {
        svgIcon: { path: 'M4 4h16v16H4z', viewWidth: 24, viewHeight: 24 },
        tooltip: 'Example'
    },
    panel: { domContent: panelRoot, title: 'Example' }
}, true);
PropertyMeaning
idOptional. An id is generated if you leave it out.
icon.svgIconAn SVG path with the size of its view box. Instead you can pass icon.hrefIcon with the address of an image in href.
icon.tooltipText shown when the pointer is on the icon.
panel.domContentA div element with the content of the panel.
panel.titleTitle in the header of the panel.
panel.hideHeader, panel.userRemovable, panel.unmountOnCloseHide the header, show a close button in the header, remove the content from the page while the panel is closed.
onClickCalled when the user clicks the icon. An item without panel is a plain button.
bottomTabtrue places the item in the lower group of the menu.

The second argument true opens the new tab at once. The call returns a handle with open(), close(), remove(), setLoading(value), disableIcon(), enableIcon(), hideIcon() and showIcon(). There is no function to change an item: remove it and add it again.

A notification

window.map.stores.mapState.notificationHandler.displayNotification({
    message: "Test Notification <br /><br /> Second Line",
    severity: 'info', // 'success' | 'info' | 'warning' | 'error',
    position: {
        vertical: 'top', // 'top' | 'bottom'
        horizontal: 'right' // 'left' | 'center' | 'right'
    },
    duration: 10000
});

duration is given in milliseconds. Without it the notification stays for six seconds.

Queries

executeQuery runs a query that an administrator defined in Studio and returns its result. You pass the name of the query and a request:

const queryName = 'Query_Name';
const queryRequest: QueryJsonRequest = {
    format: 'json',
    parameters: {},
    srid: 3857
}

executeQuery(queryName, queryRequest).then(result => {
    console.log(result)
});
Property of the requestMeaning
format'json', 'geoJson' or 'csv'
parametersValues for the placeholders of the query, by name. Pass {} if the query has none.
sridEPSG code into which the geometries are transformed, or null.
FormatResult
'json'{ rowCount, rows }, with one object per row
'geoJson'A GeoJSON FeatureCollection
'csv'The result as text

See Query execution for Browser Apps for a complete example and Queries for how to define a query.

performQuery, which sends SQL text from the script, is deprecated. The server rejects it unless Enable deprecated SQL query is switched on in the settings in Management.

Workflows

const name = 'EditBuildingsWF';
const nodeId = 'EditBuildingForm';
const id = '344273';

openWorkflow(name, nodeId, id);
ArgumentMeaning
workflowNameName of the workflow
nodeIdThe node of the workflow to open
idOptional. The id of a record, for example of the feature to edit.
windowOptionsOptional. Size and position of the window, in the form the browser function window.open expects. Default: 'width=700,height=600'.

The workflow opens in a new browser window. The current state of the map, such as the selection, is not passed to a workflow opened this way. To open a workflow with the map state, use an action set.

Files from the server

A script can load files that an administrator placed in the warehouse folder of the server: configuration, lookup lists, small data files.

FunctionReads fromWho can read it
getWarehouseFilePublic(fileName)<warehouse>\_publicAnyone who can reach the server, without a login. Subfolders are allowed.
getWarehouseFilePrivate(fileName)<warehouse>\<tenant>\_publicUsers who are logged in to this tenant. No subfolders.

Both functions return a promise. getWarehouseFilePublic resolves to the response of the request; read it with text(), json() or blob():

const response = await getWarehouseFilePublic('settings.json');
const settings = await response.json();

A file that does not exist rejects the promise.

For the administrator:

  • The two folders do not exist after the installation. Create them and copy the files into them. There is no upload in Studio.
  • Do not put anything confidential into the folder _public at the top of the warehouse. Its files can be read without a login.
  • The folders are not part of a tenant export. Include them in your backup.

Messages between panels

The scripts of the panels of one app can send each other messages. A panel is addressed by its title in the App Engine.

FunctionMeaning
ready(callback)Calls callback when all panels that have a script are loaded.
post(payload, to?)Sends payload to the panel with the title to. Without to, to all other panels. The payload can be any value, also a function.
listen((from, payload) => { ... })Receives the messages of all panels. from is the title of the sender.
listenTo(from, (payload) => { ... })Receives only the messages of the panel with the title from.

In the receiving panel:

listen((from: string, message: any) => {
    console.log(`Message received from ${from}: ${message}`);
})

In the sending panel:

ready(() => {
    post('Hi there!');
});

Only panels with a script take part. A dashboard panel or a workflow panel cannot send or receive messages this way.

Forms and tables

FormInstance.create(parent, config) and TableInstance.create(parent, config) build a form or a table inside an HTML element of your panel. Both return an object with destroy() and further functions. They are described on their own pages:

Point clouds

addPointCloudClassificationStyle(layerId, attributeList) defines, for a point cloud layer, which classes the user can switch on and off and in which color they are drawn. For each attribute you pass a list of entries with label, color and, optionally, visible. See Integration of PEGASUS Data.

Snippets in the editor

The editor of the App Engine comes with 43 snippets that you drag into your script. They are the quickest way to a working start:

GroupExamples
MapPan to point, Pan to bounds, Zoom in/out, Add a copyright notice, Define navigation restrictions
LayerFind layer by label, Show/hide layer, Add custom tooltip, Create WMS layer
VectorAdd event handler for SelectionChanged event, Create a custom painter
TransformationsPoint transformation, Bounds transformation, Register a custom coordinate system
Point CloudPoint Cloud Styling, Point Cloud Classification
CommunicationThe message functions described above
MAE InterfaceOpen a workflow, Show a notification, Execute Query, Load an external library, Show mouse location, Address search, Change selection style
RecipesListen for process start, Listen for process finish, Get process outputs
Utility, Markup, StyleLoad external libraries, a simple header for a custom panel and its style

A snippet marked as map script only works in the script of a Map View.

Updated on Dec 1, 2026