App config parameters - hslayers/hslayers-ng GitHub Wiki
To configure hslayers-ng based map project, various configuration options can be used. They have to be specified either in the main application file (usually app.component.ts's constructor) using this.hsConfig.update(...) method.
Or in the hslayersNgConfig(ol) function in case of the "simple" application.
Example:
function hslayersNgConfig(ol) {
return {
default_layers: [
...
The following page describes all the configuration options grouped by theme.
Datasources
Property
Type
Mandatory
Default Value
Description
Deprecated
Removed in
Example
allowAddExternalDatasets
Boolean
false
true
Setting which allows adding of user provided WMS... vector file or other data to map. It is used to control display of OWS panel in addLayers module. Previously, this used to be set using Core.singleDatasources property which is now deprecated. ( Version added: 1.14.0)
Layers used in... the feature table panel (undefined by default).
Map
Property
Type
Mandatory
Default Value
Description
Deprecated
Removed
Example
box_layers
Array<ol.Group>
false
An array of ol.layer.Group objects... used to group layers into topics. Each box layer must contain layers property which is an array of ol.layer.Layer objects similar to default_layers config property. Name of the group is contained in "title" property and path to icon image can be provided in "img" property.
default_view
ol.View
true
OpenLayers view which specifies default map center, projection, zoom etc.
Array of layers which... are OpenLayers layers and are not part of a layer group or "box" layer. They can contain extra parameters not specified in OL API such as "path", "show_in_manager", "base", "position", etc.
Enable map interactions, such as, double click zoom, keyboard zoom, pinch rotate, and more
saveMapStateOnReload
Boolean
false
true
When set to true..., the list of current map layers is saved into the browser's localStorage once the application is closed so they can be restored after the reload.
zoomWithModifierKeyOnly
Boolean
false
false
Description... - true: map will zoom on scroll event only if platform modifier key is also pressed. This key is CTRL on Windows or Linux and META key on macOS, respectively. Useful for page-wide maps incorporated in a singe-page design. - false: default. No additional key is required. Map zooms on sole mouse-scroll event.( Version added: 1.14.0)
Default view example:
new ol.View({
center: ol.proj.transform([17.474129, 52.574000], 'EPSG:4326', 'EPSG:3857'), //Latitude longitude to Spherical Mercator
zoom: 4,
units: "m"
})
Set to true to open layer manager when map composition is loaded.
pathExclusivity
Boolean
false
true
Determines behavior of exclusive layers... (layer.exclusive = true) visibility. If set to true, only layers with same path are affected by exclusivity.
reverseLayerList
Boolean
false
true since 8.0
Display layer manager layers in reverse order.
timeDisplayFormat
String
false
Specifies time display format for layer manager time-aware WMS layers.
Share Service and Compositions Catalogue
Property
Type
Mandatory
Default Value
Description
Deprecated
Removed
Example
advancedForm
Boolean
false
false
Specifies if advanced save map form should be created.
comp_keywords
Boolean
false
Show drop-down for filtering of compositions based on keywords.
URL or path of status manager... Usually it is on the same server and then '/wwwlibs/statusmanager2/index.php' or similar can be used. Replaced by hostname.shareService.url
yes
12.0
hostname.shareService
Object
false
hostname.shareService.url
String
true
URL or path to share service... Usually it is on the same server and then '/wwwlibs/statusmanager2/index.php' or similar can be used.
hostname.user.url
String
false
hostname.user.type
String
false
The type of the hostname... (denoting for which purposes it should be used) – e.g. compositions_catalogue (for compositions catalogue), status_manager (for status manages), default (fallback for the previous two), user (overriding the defaults).
yes
yes
hostname.user.editable
Boolean
false
Should be able to delete... or change this hostname object from the list of hostnames.
yes
yes
project_name
String
false
Variable of project name... which is used as a project GET parameter queries to status manager when loading compositions list and making updates and deletes.
status_manager_url
String
false
URL or path of status manager... Usually it is on the same server and then '/wwwlibs/statusmanager2/index.php' or similar can be used. Replaced by shareServiceUrl
yes
12.0
shareServiceUrl
String
false
URL or path to share service... Usually it is on the same server and then '/wwwlibs/statusmanager2/index.php' or similar can be used.
Set this to 'md' to use Material Design instead of Bootstrap. (Experimental)
3.0
draggable_windows
Boolean
false
Specify if panels can be dragged out of side-panel.
yes
importCss
Boolean
false
true
Specify if import css files... (openlayers.css, bootstrap.min.css, icon fonts). Set this to false for webpack usage where css is imported/required specifically outside HSL.
yes
yes
locationButtonVisible
Boolean
false
Use componentsEnabled.geolocationButton parameter instead.
Hide all GUI elements... leaving only the map itself. This is a shorthand for componentsEnabled.guiOverlay: false and mapInteractionsEnabled: false.
sizeMode
String
false
fullscreen
Possible values: 'fullscreen', 'container'.
yes
yes
sidebarPosition
String
false
right
One of 'left', 'right' or 'bottom'.
sidebarToggleable
Boolean
false
true
Enable sidebar function... to open/close sidebar (if false sidebar panel cannot be opened/closed through GUI)
sidebarClosed
Boolean
false
window.innerWidth < 767
Specify whether sidebar should be opened or closed on startup. (Version added: 1.12.0)
useIsolatedBootstrap
Boolean
false
right
Load bootstrap CSS from... node_modules/bootstrap/dist/css/bootstrap.isolated.css , which can be generated using npm explore hslayers-ng -- npm run isolate-bootstrap if hslayers-ng is dependency of your app or npm run isolate-bootstrap if you have cloned hslayers-ng repo directly. See Bootstrap isolation.
yes
yes
theme
String
true
Set the application style theme. (Version added: 1.13.0)
Pixel value of CSS breakpoint activating GUI changes for mobile view. Deactivated when 'sidebarPosition' is set to 'bottom'.
mobileBreakpoint: 767
panelsEnabled default:
{
compositions: true,
query: true
toolbar: false,
draw: false,
addData: true,
layerManager: true,
legend: true,
info: true,
print: true,
saveMap: true,
language: true,
share: true,
feature_crossfilter: true,
featureTable: true,
info: false,
tracking: false,
tripPlanner: false,
mapSwipe: false, //A component for splitting a map into two parts with a slider, allowing the user to display the contents of different layers in
//parallel on top of each other.
sensors: false,
}
For simple apps use assetsPath: 'https://unpkg.com/[email protected]/assets/' or alike (replace 3.1.0 with the actual version of HSL you are using)
In discontinued HSLayers-NG versions 1 and 2 this was set via:
window.HSL_PATH + 'assets',
componentsEnabled example:
{
guiOverlay: true, //all GUI components at once
sidebar: true, //REMOVED in 3.0. REPLACED BY sidebarPosition: 'invisible' //sidebar with UI panels. Visible panels can be set with panelsEnabled
//object,
info: true,
toolbar: true, //all toolbars at once: draw, search and measure
drawToolbar: true, //toolbar to draw/edit features
searchToolbar: true, //toolbar with search field
measureToolbar: true, //toolbar to measure distances/areas
geolocationButton: true, //button which allows to geolocate the user and optionally follow his/her position
defaultViewButton: true, //button to zoom and pan to an initial extent
mapControls: true //buttons to zoom in/out and the scale
basemapGallery: false //Move basemaps list into separate GUI component located in the map
mapSwipe: false //Enables map-swipe right after app starts
queryPopup: true, //Enables queryPopup functionality
}
createExtraMenu example:
function ($compile, $scope, element) {
$scope.uploadClicked = function () {
alert("UPLOAD!")
}
var el = angular.element("<li class=\"sidebar-item\" ng-click=\"uploadClicked()\" ><a href=\"#\"><span class=\"menu-icon glyphicon icon-cloudupload\"></span><span class=\"sidebar-item-title\">Upload</span></a></li>");
element.find('ul').append(el);
$compile(el)($scope);
}
panelWidths example:
{
compositions: 500
}
theme example:
theme: 'dark'
Query
Property
Type
Mandatory
Default Value
Description
Deprecated
Removed
Example
customQueryPopupWidgets
Array<WidgetItem>
false
Allows the user to add custom widgets to query popup.
openQueryPanelOnDrawEnd
Boolean
false
Specifies if query panel should be opened when finished drawing.
popUpDisplay
'none' , 'click' , 'hover'
false
none
When the feature pop-ups should be displayed. (Version added: 1.23.0)
How to display point clicked on the map...'notWithin' - Hides clicked point feature in case it would overlap with other features 'hidden' - Hides clicked point feature at all times
query
Object
false
Object for setting query options.
query.multi
Boolean
false
false
Allow selecting and displaying info about multiple vector layer features.
queryPopupWidgets
ShowArray<QueryPopupWidgetsType> | Array<string>
false
Show['layer-name', 'feature-info', 'clear-layer']
Configures query popup widgets..., the order in which they are generated, and visibility.
It is possible to zoom to features, display hover pop-up over them or do custom actions when user hovers, clicks or triggers any other event on external HTML elements such as links in text outside HSLayers-NG. To configure such behaviour set:
domSelector - a string containing CSS selector such as #link1 or .links
feature - Must be an ID property of feature, feature instance or a function, which will return one feature given a layer and an HTML element upon which the event was triggered on.
event - any HTML event name on HTML element which can be handled by addEventListener
actions - an array of predefined actions or a function to be executed on the found feature.
Search
Property
Type
Mandatory
Default Value
Description
Deprecated
Removed
Example
geonamesUser
String
true
Geonames API username.
searchProvider
String | Function | Object
false
['geonames']
For adding additional geo-data search providers.
search_provider
String
false
Specify which search provider should be used. Can contain values: 'sdi4apps_openapi', 'geonames'.
Determines whether the last point of drawn (sketch) feature... should be preserved or not. If yes, minimum of 3 saved vertices are necessary to finish drawing of polygon (2 otherwise). (Version added: 2.4.0)
proxyPrefix
String
false
/cgi-bin/hsproxy.cgi?
Url to use for proxy in which case url=... parameter is added to the get request. If other proxy service is used non-encoded url will be added directly to the proxyPrefix specified e.g. "/proxy/https://www.google.com" in case of "/proxy/".
useProxy
Boolean
false
true
Whether to use proxy or not. Might be useful in Cordova apps, where proxying is not needed.
//Use together with `enabledLanguages` and `translationOverrides`.
"language": "esp",
"enabledLanguages": "esp,en,lv",
"additionalLanguages": {
"esp": "Espanol"
}