Skip to content

Layer parameters

jmacura edited this page Oct 7, 2024 · 41 revisions

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 features 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 upon 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 separated 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 specific 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:
{
   "cs": {
       "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 shown 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
  • wfsAttributes: Array<WfsFeatureAttribute>: - A list of attributes of related WFS service. Each attribute has form:
    • name: string
    • type: string
    • isNumeric: boolean
    • values?: string[] | number[]
    • range?
      • min: number
      • max: number
  • 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
  • label: string
  • name: string
  • title: string
  • unitId: string | number - sensor unit identity
  • wp: Waypoint

Source

Additionally, we extend OpenLayers' Source with these parametres:

  • legendCategories: Array<Object> - an array, where each item represents one category. Each category must conform to an object of type
    • name: String - a (unique) name of the category
    • color: String - rgb(a) or hex code of the color display (optional)
    • path: String - relative path or URL to the icon image that shall be displayed instead of the color (optional)
    • height: number - a height of the icon image in pixels, defaults to 32 px.
  • loaded: Boolean - removed, use OL events or related HsEventBusService subjects instead
Clone this wiki locally