map.apps ETL Realtime

map.apps ETL Realtime is a bundle used to visualize realtime information on a map. It’s completely separate from the other map.apps ETL bundles and is therefore described individually.

Requirements

Realtime data is based on a FME Server Websocket Stream. Therefore, a connection to the FME Server has to be possible for the browser.

  • Default Port: 7078

  • Protocol: ws / wss

Configuration in map.apps

The following properties can be set for map.apps ETL Realtime in the app.json.

app.json
"mapapps_etl_realtime": {
    "RealtimeETLFactory": {
        // connection parameters for the FME Server stream
        "streamUrl": "wss://<your fme server>:7078",
        "streamId": "<stream id>",

        // Automatically connect to stream on app start?
        "autoStartStream": true,

        // If enabled, all features will be removed from the map if a new message is received
        "removeExistingFeatures": false,

        // Layer name as visible in the TOC
        "layerName": "AIS Data",
        "groupLayerName":  "Realtime",

        // automatically zoom to the map extent that shows all features if a new message is received
        "zoomToFeatures":  false,

    }
}

Features on the map will automatically be updated if the id attribute is provided again on a new feature. Otherwise all features will be drawn on the map. In this case, only updates have to be provided in the WebSocket messages. This method provides the best performance in map.apps.

If these updates can’t be provided, the parameter removeExistingFeature can be used. If this parameter is enabled, all previous features will be removed if a new message is received. This means that all features that should be visible have to be included in every message.

Configuration in FME Server

map.apps expects a JSON document in the following structure in each individual WebSocket message. The message can consist out of multiple layers. Each layer has to contain an array of features in the EsriJSON format.

Features in map.apps will be drawn on to a GraphicsLayer and can each be styled individually by providing a symbol property. You can find you simple configuration in the ArcGIS Symbol Playground .

An explanation on how WebSockets can be sent via FME workspaces can be found in the FME Documentation .

Websocket Message Format
{
  "layers": [
    {
      "RecordSet": {
        "features": [
          {
            "geometry": {
              "x": -13622433.074419683,
              "y": 4550362.787921864,
              "spatialReference": {
                "wkid": 3857
              }
            },
            "attributes": {
              "id": "1",
              "name": "Name 1",
              "symbol": {
                  "type":
                  "simple-marker",
                  "color": [255, 3, 3, 0.25]
                }
            }
          },
          {
            "geometry": {
              "x": -13626431.580299314,
              "y": 4557659.239902122,
              "spatialReference": {
                "wkid": 3857
              }
            },
            "attributes": {
              "id": "2",
              "name": "Mendocino",
              "symbol": {
                "type": "web-style",
                "name": "ferry",
                "styleName": "Esri2DPointSymbolsStyle"
              }
            }
          }
        ],
        "geometryType": "point"
      }
    }
  ]
}