Class: MapBuilder

BKGWebMap. MapBuilder

Factory-Class to create a Webmapping Application. It creates a Webmapping Application using the configuration provided. To configure the map, you can use the following methods: setLayers(), setControls(), setTarget(), setView(), defineStyles(), setSecurity(), loadConfig(). You can initialize the map using the method create().

new MapBuilder()

Source:

Members

<static, constant> CLASS_NAME :string

Current class name
Source:

<static> this.called :object

Find if initialize methods have been used
Properties:
Name Type Description
setTarget boolean Method setTarget()
setView boolean Method setView()
setLayers boolean Method setLayers()
defineStyles boolean Method defineStyles()
setControls boolean Method setControls()
loadConfig boolean Method loadConfig()
setSecurity boolean Method setSecurity()
Source:

<static> this.configFile :boolean

Find if the configuration will be loaded from a file
Source:

<static> this.configUrlOrJson :null|string|object

URL of JSON configuration file or object with configuration
Source:

<static> this.controlsConfig :object|null

Configuration of controls object.
Source:

<static> this.DEFAULT_LAYERS_CONFIG :Object

Standard configuration for layers
Properties:
Name Type Description
baseLayers array Array with default baselayers configuration
Source:

<static> this.DEFAULT_VIEW_CONFIG :object

Standard configuration for view object.
Properties:
Name Type Description
projection string Default map projection.
extent array Default map extent.
Source:

<static> this.div :string

ID of HTML-Element that contains the map.
Source:

<static> this.layersConfig :object|null

Configuration of layers object.
Source:

<static> this.map :ol.Map|null

OpenLayers map object.
Source:

<static> this.viewConfig :object|null

Configuration of view object.
Source:

controls :array|null

BKG WebMap controls
Source:

styles :object|null

Object with style names and OpenLayers style classes.
Source:

stylesArray :array

Array with styles configuration that will be used for vector layers
Source:

Methods

create(callback) → {BKGWebMap.MapBuilder}

Creates the map with current configuration and returns MapBuilder object.
Parameters:
Name Type Description
callback createCallback Callback for getting ready map object. You can use it to change the map.
Source:
Returns:
Type
BKGWebMap.MapBuilder

defineStyles(stylesConfig) → {BKGWebMap.MapBuilder}

Parse styles used for vector layers
Parameters:
Name Type Description
stylesConfig Array.<symbol_style> | Array.<custom_style> Array with style configuration (/styles)
Source:
Returns:
Type
BKGWebMap.MapBuilder

getMap() → {ol.Map}

Getter: It returns the map object, but it is not ready with all elements. Better use the callback of create(): createCallback
Source:
Returns:
Type
ol.Map

loadConfig(config) → {BKGWebMap.MapBuilder}

Parses a configuration JSON for BKG WebMap. It can be either the URL of a JSON file or the JSON itself.
Parameters:
Name Type Description
config string | object JSON or filename or JSON with BKG WebMap configuration. (/)
Source:
Returns:
Type
BKGWebMap.MapBuilder

setControls(controlsConfig) → {BKGWebMap.MapBuilder}

Parses the controls configuration which is used for creating the interactive control elements of the map when calling create.
Parameters:
Name Type Description
controlsConfig object Object with configuration parameters for controls. (/options)
Properties
Name Type Description
panelPosition string Panel position (Values: "left", "right") (/options/panelPosition)
initialize string | null Tool that should be shown, when starting the Application. If empty or null, then panel will be closed. (Values: "geoSearch", "searchCoordinates", "layerSwitcher", "legend", "showAttributes", "copyCoordinates", "measure", "edit", "share") (/options/initialize)
tools object Tools in panel. (/options/tools)
Properties
Name Type Description
geoSearch object Search a place through name. (/options/tools/geoSearch). See properties in geoSearch_options
searchCoordinates object Tools in panel. (/options/tools/searchCoordinates). See properties in searchCoordinates_options
layerSwitcher object Layer menu. (/options/tools/layerSwitcher). See properties in layerSwitcher_options
customLayers object User can add new layers. (/options/tools/customLayers). See properties in customLayers_options
legend object Show legend. (/options/tools/legend). See properties in legend_options
showAttributes object Show attributes with click on map. (/options/tools/showAttributes). See properties in showAttributes_options
copyCoordinates object Tool to copy coordinates. (/options/tools/copyCoordinates). See properties in copyCoordinates_options
measure object Measure tool. (/options/tools/measure). See properties in measure_options
edit object Edit vector layers tool. (/options/tools/edit). See properties in edit_options
share object Share map. (/options/tools/share). See properties in share_options
zoom object Zoom control. (/options/tools/zoom). See properties in zoom_options
scalebar object Scalebar control. (/options/tools/scalebar). See properties in scalebar_options
copyright object Copyright control. (/options/tools/copyright). See properties in copyright_options
showCoordinates object Show coordinates of cursor position. (/options/tools/showCoordinates). See properties in showCoordinates_options
staticLinks Array.<object> Static links on map. (/options/tools/staticLinks)
See properties of each Object in Array in staticLinks_options
staticWindows Array.<object> Static windows on map. (/options/tools/staticWindows)
See properties of each Object in Array in staticWindows_options
fullScreen object Full screen tool. (/options/tools/fullScreen). See properties in fullScreen_options
overviewMap object Overview map tool. (/options/tools/overviewMap). See properties in overviewMap_options
timeSlider object Timeslider tool for WMS-T. (/options/tools/timeSlider). See properties in timeSlider_options
Source:
Returns:
Type
BKGWebMap.MapBuilder

setLayers(layersConfig) → {BKGWebMap.MapBuilder}

Parses layer configuration used for creating map layers when calling create.
Parameters:
Name Type Description
layersConfig object | array Object with configuration parameters for layers or array with ol.layer class. If OpenLayers classes are directly used, all layers are in basemaps group. (/layers)
Properties
Name Type Description
baseLayers Array.<WMS> | Array.<WMTS> | Array.<WFS> | Array.<MARKER> | Array.<CSV> | Array.<XLS> | Array.<GPS> | Array.<BKG> | Array.<NONE> Base layers. The order of layers will be used in menu. The array can have any of the following layer definitions: WMS, WMTS, WFS, MARKER, CSV, XLS, GPS, BKG, NONE (/layers/baseLayers)
overlays Array.<WMS> | Array.<WMTS> | Array.<WFS> | Array.<MARKER> | Array.<CSV> | Array.<XLS> | Array.<GPS> | Array.<BKG> | Array.<GROUP> Layers and group of layers that will be loaded as overlays. The order of layers will be used in menu. The array can have any of the following layer definitions: WMS, WMTS, WFS, MARKER, CSV, XLS, GPS, BKG, GROUP (/layers/overlays)
Source:
Returns:
Type
BKGWebMap.MapBuilder

setSecurity(securityConfig) → {BKGWebMap.MapBuilder}

Parse configuration for security. Define cookieCheck and information about secure BKG Services.
Parameters:
Name Type Description
securityConfig object Security options. (/security)
Properties
Name Type Description
cookieCheck boolean Should the application use cookie test. (/security/cookieCheck)
UUID string BKG UUID. (/security/UUID)
appID string BKG Application ID. (/security/appID)
appDomain string Domain for BKG Application ID. (/security/appDomain)
Source:
Returns:
Type
BKGWebMap.MapBuilder

setTarget(div) → {BKGWebMap.MapBuilder}

Sets the HTML-Element that contains the map
Parameters:
Name Type Description
div string ID of HMTL-Element that contains the map
Source:
Returns:
Type
BKGWebMap.MapBuilder

setView(viewConfig) → {BKGWebMap.MapBuilder}

Parse configuration for view. Parses the view configuration which is used for creating the map view when calling create.
Parameters:
Name Type Description
viewConfig object | ol.View Object with configuration parameters for view or ol.View class
Properties
Name Type Description
projection string Map projection (/map/projection)
center object Initial center of map (The coordinate system is defined through the projection) (/map/center)
Properties
Name Type Description
lat number Map center latitude. (/map/center/lat)
lon number Map center longitude. (/map/center/lon)
resolution number | null Initial resolution. If null, zoom will be used. (/map/resolution)
resolutions Array.<number> | null Array with numbers. If set, scales, maxResolution, minResolution, minZoom, and maxZoom are ignored. (/map/resolutions)
scales Array.<number> | null Array with numbers. It will be used only if resolutions is null. If set, maxResolution, minResolution, minZoom, and maxZoom are ignored. (/map/scales)
zoom integer | null Initial zoom. It will be used only if resolution is null. (/map/zoom)
mapExtent Array.<number> | null Initial map extent. Array with numbers: [minX, minY, maxX, maxY] (/map/mapExtent)
maxResolution number | null Maximum resolution. It will be used only if resolutions and scales are null. If null, maxZoom will be used. (/map/maxResolution)
minResolution number | null Minimum resolution. It will be used only if resolutions and scales are null. If null, minZoom will be used. (/map/minResolution)
maxZoom integer | null Maximum zoom. It will be used only if maxResolution, resolutions and scales are null. (/map/maxZoom)
minZoom integer | null Minimum zoom. It will be used only if minResolution, resolutions and scales are null. (/map/minZoom)
Source:
Returns:
Type
BKGWebMap.MapBuilder