Layer parameters - hslayers/hslayers-ng GitHub Wiki

Layer

We extend the OpenLayers' Layer definition object with the following parametres:

  • abstract: String - description of layer which is shown in layer editor and as a tooltip in layermanager panel
  • active: Boolean - Used for layer Group to indicate currently active group (theme) which is shown thumbnails in layermanager.
  • access_rights: Object - Access rights set for Layman server
    • access_rights.write: string - Write access rights
    • access_rights.read: string - Read access rights
  • attribution: Object - Layers attribution info which is an object containing attributes:
    • logoUrl: Object - containing image format and URL path to the image
      • format: String - image format
      • onlineResource: String - image URL path
    • onlineResource: String - URL to resource domain
    • title: String - attribution title
  • autoLegend: Boolean - Allows to disable creation of automatic legend, either in Legend panel or in LayerManager settings. Default: true. Version added: 5.0
  • base: Boolean - layer will act as base layer for the map
  • capabilities: Object - Cached capabilities
  • cluster: Boolean - layer containing features will be grouped into clusters based on the configurable distance between features
  • customInfoTemplate: String - BROKEN - Html template to use instead of the default info panel template for displaying getFeatureInfo results and selected vector feactures attributes.
  • definition: Object - An object used to describe how a vector layers features should be populated, which is used when encoding the layers into composition format
    • format: String - Can contain 'hs.format.WFS', 'ol.format.KML', 'ol.format.GeoJSON', 'ol.format.GPX', 'hs.format.Sparql'
    • url: String - url to the service or static file used to populate the layer
  • dimensions: Object - object of type
    • time: Object - object of type
      • label: String - Human readable title of the dimension
      • value: String - date serialized in ISO8601 format
      • onlyInEditor: Boolean - Set to true to disable the time picker in the layer managers list but only enable it when a specific layer is opened in the editor.
      • values Array - List of valid dates
      • type: 'date' | 'datetime' - Use datetime to also enable time picker in layer editor panel
      • default - default date serialized in ISO8601 format. For backwards compatibility
  • dimensions_time: Object | Array<Object> - DEPRECATED since 3.0.0 - Configuration to display time dimension using controls in layer editor.
  • editor: Object - Set if a layers feature geometry and attributes can changed. If no editor config is provided layer is editable by default without any predefined attributess. Editor object contains further config:
    • editable: Boolean - true by default
    • defaultAttributes - directory of attribute names as keys and values describing the default values to be set for new features.
  • enableProxy: Boolean - Turn off proxy of layers if service on other domain already contains all the necessary CORS headers to not trigger XSS errors.
  • eventsSuspended: Number (readonly) - Internal property to disable sending features to WFS service while they are being pulled from the server. Wait for all pull operations (eventsSuspended is their count) to finish first.
  • exclusive: Boolean - When layer is ticked as visible in layer manager panel, turn other layers belonging to the same 'path' as invisible which in a way mimics radio buttons.
  • featureInfoLang Object - A dictionary where the keys represent language codes (see HsLanguageService.listAvailableLanguages) and values point to a WMS service url which is used for GetFeatureInfo requests for a speciffic language instead of the configured default WMS service URL.
  • fromComposition: Boolean - layer loaded from composition file. This is used to remove previously loaded layers when a new composition is loaded.
  • getFeatureInfoTarget: String - name of the component responsible for displaying layer information. If we want the results to be displayed in hslayers Info panel then set getFeatureInfoTarget='info-panel', otherwise the element will be searched using this query 'ol-popup ' + layer.get('popupClass')
  • hsLaymanSynchronizing: Boolean (readonly) Used internally to display loading icon while features are synchronized with Laymans WFS endpoint.
  • infoFormat: string - Set this for WMTS layers to specify mime type in which to return GetFeatureInfo data since OL doesn't create URL for getFeatureInfo automatically. For WMS layers this is handled by providing INFO_FORMAT attribute inside ol​/source​/TileWMS or ol​/source​/ImageWMS params object and used in getFeatureInfoUrl internaly.
  • inlineLegend: Boolean - Enable legend image inside layer editor tab. If 'legend' panel is disabled in panelsEnabled config then Legend graphics is shwon in layer editor nevertheless for backwards compatibility.
  • laymanLayerDescriptor: HsLaymanLayerDescriptor (readonly) - Internal object used to store information about matching layer in Layman
  • legends: Array<String> - array of legend URLs (Explore how it relates to styles and if we need a more complex structure because legends map to wms layer styles where there can be more than one and with a specific name. see: this.setOrUpdate(layer, 'Layer', layers); this.setOrUpdate(layer, 'Legends', legends); this.setOrUpdate(layer, 'MetadataURL')
  • maxResolutionDenominator: Number - Override maxResolution for a layer which contains sublayers with various maxResolutions. Otherwise the maximum resolution of all the children layers would be used.
  • metadata: Object - URL to layers metadata
  • minimumTerrainLevel: Number - Used in cesium to display layer only from certain terrain level (we can use minResolution because the surface can be looked uppon from an angle)
  • name: String - Layers human-unfriendly name
  • onFeatureSelected: Function - custom callback executed when a feature is clicked. Feature is provided in the first parameter.
  • path: String - Layers location in the folder structure used in layer manager seperated by slashes for example: /user layers/vegetation/group1
  • popUp: Object - object of type controlling the popup element when hovering/clicking over a vector feature
    • attributes: Array<String> | Array<Object> - containing either names of attributes to display or objects of type
      • attribute: String - name of the attribute
      • displayFunction?: Function - alternative function to format the attribute value
      • label?: String - alternative label to display instead of the attribute name
    • displayFunction?: Function which receives feature object as a param and generates a text or html content to display in popup instead of the default widgets.
  • popupClass: String - If getFeatureInfo format (INFO_FORMAT WMS sources param) includes 'html' then the results will be added to a popup element and and it's class set to 'ol-popup ' + popupClass. This can be used to style/resize the popup differently for each layer.
  • queryable: Boolean - Set to false to not open info panel on vector layers feature selection.
  • queryCapabilities: Boolean: Set to true to disable background querying of WMS layers capabilities, to keep hard-coded overrides, reduce requests to server or other reasons.
  • queryFilter: Function(map:ol​/Map, layer, pixel) - Function which must be undefined or return true to execute getFeature requests for speciffic layers and pixels. map.getCoordinateFromPixel(pixel) can be used to disable GetFeatureInfo requests at certain coordinates.
  • removable: Boolean - Needs to be true for the layer to be removable by clicking Remove all layers button in the UI. Default true for all layers added by user using the UI. Default false for all layers added by applications configuration provided through HsConfig or hslayersNgConfig.
  • showInLayerManager: Boolean - layer is visible inside Layermanager panel
  • sld: String - Styled Layer Descriptor (SLD)
  • sublayers: String - Comma seperated list of sublayer names to override the sublayers list of a container layer in case it contains too many sublayers and only a subset is needed to be displayed. This is used to limit the displayed sub-layers on the map. If sublayers property is set, the sub-layer tree in layer manager is hidden, otherwise all sub-layers are shown.
  • swipeSide: String - Determines on which side of the swipe controller the layer will be on: 'left' or 'right'.
  • thumbnail: string - Filename of thumbnail image used in base map picker which needs to be placed in this.HsUtilsService.getAssetsPath() + 'img/' directory
  • title: String - layer human readable title of layer. Can be translated using HsConfig.translationOverrides i.e:
{
   "cz": {
       "LAYERS": {
          "<layer_title_in_english>": "<layer_title_in_czech>"
      }
   }    
}
  • virtualAttributes: Object: An object where its keys represent dynamic feature attribute names and values are callback functions which take feature as parameter and must return a static value or HTML code used as feature attributes value. These key-value pairs are shwon in info panel and feature list panel. Example to output features area in hectares:
layer.set('virtualAttributes', {
        area: function(feature: Feature){
          const geom = feature.getGeometry();
          if(geom){
            return (getArea(geom) / 10000).toFixed(2) + 'ha';
          } else {
            return '';
          }
        })
  • workspace: string: - Currently logged in Layman user workspace
  • wfsUrl: string: - External WFS url

Feature

Additionally, we extend OpenLayers' Feature with these parametres:

  • features: Array<Feature> - array of features when the source is clustered, undefined otherwise
  • highlighted: Boolean - feature is currently selected
  • hstemplate: (TODO: deprecate or create the custom template functionality since, it's not supported currently)
  • label: String
  • name: String
  • title: String
  • unitId: String | Number - sensor unit identity
  • wp: Waypoint

Source

Additionally, we extend OpenLayers' Source with these parametres:

  • loaded: Boolean
⚠️ **GitHub.com Fallback** ⚠️