Geoportal SDK 2D/3D API Reference

Namespace: ControlOptions

Gp.ControlOptions

Control options object.

Holds options for a specific control present on the map. May be used for map creation (See controlsOptions property of Gp.MapOptions object used as a parameter of Gp.Map.load() function) or for map modification (See Gp.Map.addControls() or Gp.Map.modifyControls()).

Given a specific control, availables options are the following :

Options for "zoom" control

Specific 2D options

property Type Description
div String / DOMElement Target HTML element container or its id. Default is chosen by map implementation.

Options for "overview" control

Common 2D/3D options

property Type Description
div String / DOMElement Target HTML element container or its id. Default is chosen by map implementation.
maximised Boolean If the control has to be opened or not.

Specific 2D options

property Type Description
layers Array(String) List of layers Ids to be displayed on the overview map (may be part of main map layersId or a geoportal WMTS layer ID). If none, all main map layers will be used.
minZoom Number min zoom level for overview map.
maxZoom Number max zoom level for overview map.
projection String projection code for overview map.

Specific 3D options

property Type Description
position String The type of positionment of the overview element inside its container. Can be "absolute" or "relative" ("absolute" by default)
width Number The width of the minimap (100px by default)
heigth Number The height of the minimap (100px by default)
x Number The position of the minimap from the left of the container div (20px by default)
y Number The position of the minimap from the bottom of the container div (20px by default)

Options for "orientation" control

Specific 2D options

property Type Description
div String / DOMElement Target HTML element container or its id. Default is chosen by map implementation.
autoHide Boolean If true (default), control is not shown when map is oriented to th north.

Options for "graphicscale" control

Common 2D/3D options

property Type Description
div String / DOMElement Target HTML element container or its id. Default is chosen by map implementation.

Specific 2D options

property Type Description
units String Units to display : "deg" (degrees) or "m" (metric values).
minWidth Number Minimum width in pixels. Default is 64.

Specific 3D options

property Type Description
maximised Boolean Display or not the control
x Number The position of the minimap from the left of the container div (20px by default)
y Number The position of the minimap from the bottom of the container div (20px by default)

Options for "mouseposition" control

Common 2D/3D options

property Type Description
div String / DOMElement Target HTML element container or its id. Default is chosen by map implementation.
maximised Boolean if the control has to be opened or not.
systems Array(Object) List of coordinates systems available for display.
systems.crs String Coordinates system ID.
systems.label String label used to designate the CRS.
systems.type String "Geographical" or "Metric"
units Array(String) units used for coordinates display ("m", "km" for Metric coordinates, "dec", "dms", "rad" or "gon" for geographical coordinates).
displayAltitude Boolean (de)activate altitude display
displayCoordinates Boolean (de)activate planimetric coordinates display.
altitude Object altitude interaction specific configuration. Implementation specific.

Specific 2D options

property Type Description
editCoordinates Boolean Allows users to change map center by giving their coordinates. False by default.
positionMarker Object options for a position marker to use when editingCoordinates.
positionMarker.url String Marker url
positionMarker.offset Array(Number) Offsets in pixels used when positioning the marker towards targeted point. The first element in the array is the horizontal offset. A positive value shifts the marker right. The second element in the array is the vertical offset. A positive value shifts the marker down. [0,0] value positions the top-left corner of the marker image to the targeted point. Default is offset associated to default marker image.
positionMarker.hide Boolean If true, marker is not displayed, otherwise displayed (False by default.)

Options for "route" control

Specific 2D options

property Type Description
div String / DOMElement Target HTML element container or its id. Default is chosen by map implementation.
maximised Boolean if the control has to be opened or not.
exclusions Object exclusions to be proposed for control. Il null all exclusions will be proposed by default.
exclusions.toll Boolean proposing toll exclusion. If true, this exclusion will be checked by default.
exclusions.bridge Boolean proposing bridge exclusion. If true, this exclusion will be checked by default.
exclusions.tunnel Boolean proposing tunnel exclusion. If true, this exclusion will be checked by default.
graphs Array(String) available graphs to be proposed by control among "Pieton" (pedestrian) and "Voiture" (car). The first element of the array will be the default proposition of the control.
markersOpts Object options to use your own markers. Object properties can be "departure", "stages" or "arrival". Corresponding value is an object with following properties :
markersOpts[property].url String marker base64 encoded url (ex "data:image/png;base64,...""). Mandatory for a custom marker
markersOpts[property].offset Array Offsets in pixels used when positioning the overlay. The first element in the array is the horizontal offset. A positive value shifts the overlay right. The second element in the array is the vertical offset. A positive value shifts the overlay down. Default is [0, 0].)
routeOptions Object route service options. For advanced use only. See Gp.Services.route() to know all route options.
autocompleteOptions Object autocomplete service options. See Gp.Services.autoComplete() to know all autocomplete options.

Options for "isocurve" control

Specific 2D options

property Type Description
div String / DOMElement Target HTML element container or its id. Default is chosen by map implementation.
maximised Boolean if the control has to be opened or not.
exclusions Object exclusions to be proposed for control. Il null all exclusions will be proposed by default.
exclusions.toll Boolean proposing toll exclusion. If true, this exclusion will be checked by default.
exclusions.bridge Boolean proposing bridge exclusion. If true, this exclusion will be checked by default.
exclusions.tunnel Boolean proposing tunnel exclusion. If true, this exclusion will be checked by default.
graphs Array(String) available graphs to be proposed by control among "Pieton" (pedestrian) and "Voiture" (car). The first element of the array will be the default proposition of the control.
methods Array(String) available methods of computation to be proposed by control among "time" (isochron) and "distance" (isodistance). The first element of the array will be the default proposition of the control.
directions Array(String) available directions to be proposed by control among "arrival" (isocurve to arrival point) and "departure" (isocruve from departure point). The first element of the array will be the default proposition of the control.
markerOpts Object options to use your own marker. Default is a lightOrange marker.
markerOpts.url String marker base64 encoded url (ex "data:image/png;base64,...""). Mandatory for a custom marker
markerOpts.offset Array Offsets in pixels used when positioning the overlay. The first element in the array is the horizontal offset. A positive value shifts the overlay right. The second element in the array is the vertical offset. A positive value shifts the overlay down. Default is [0, 0]. (see https://openlayers.org/en/latest/apidoc/module-ol_Overlay-Overlay.html)
isocurveOptions Object isocurve service options. For advanced use only. See Gp.Services.isocurve() to know all isocurve options.

Options for "graticule" control

Specific 2D options

property Type Description
div String / DOMElement Target HTML element container or its id. Default is chosen by map implementation.
strokeColor String stroke color expressed in hex format (default : #000000)
strokeOpacity Number stroke opacity expressed between 0 and 1 (default : 0.2).
strokeWidth Number stroke width expressed in pixels (default : 1).

There are other native options for "Graticule control": see ol/Graticule.

Options for "layerswitcher" control

Common 2D/3D options

property Type Description
div String / DOMElement Target HTML element container or its id. Default is chosen by map implementation.
maximised Boolean if the control has to be opened or not.

Options for "getfeatureinfo" control

Specific 2D options

Property Type Argument Default Description
div String / DOMElement Target HTML element container or its id. Default is chosen by map implementation.
options Object Defines control options.
options.hidden Boolean optional false Specifies if the widget should be hidden.
options.auto Boolean optional false Specifies if the control run in automatic mode. In automatic mode all vector layers added on run time or added at map initialization can be requested through the control. The triggering event of those layers is the default event.
options.active Boolean optional true Specifies if the control is active or inactive. When inactive no request is fired and no information displayed.
options.defaultEvent String optional 'singleclick' Specifies the default triggering event chosen in the list ['singleclick', 'dblclick', 'contextmenu']. This is the triggering event of all layers added to the control without configured triggering event.
options.defaultInfoFormat String optional 'text/html' Indicates the default format mime-type of the response of GetFeatureInfo requests.
options.cursorStyle String optional 'pointer' Specifies the type of cursor to be displayed when pointing on vector feature of a layer previously added to the control. The value must be choosen in the possible values of the css cursor property.
options.autoPanOptions Gp.AutoPanOptions optional Defines autoPan Options for popup display on click.
layers Object List of layers requested by the control and their options (those layers have to be queryable). Associative array mapping ids of layers and their properties :
  • event (String, optional) : name of the mouse event triggering the "getfeatureinfo" request.
  • infoFormat (String, optional) : indicates the format mime-type of the response of GetFeatureInfo requests.

Options for "layerimport" control

Specific 2D options

property Type Description
div String / DOMElement Target HTML element container or its id. Default is chosen by map implementation.
maximised Boolean if the control has to be opened or not.
layerTypes Array data types that could be imported : "KML", "GPX", "GeoJSON", "MapBox", "WMS" and "WMTS". Values will be displayed in the same order in widget list. Default is : ["KML", "GPX", "GeoJSON", "WMS", "WMTS"]
webServicesOptions Object Options to import WMS or WMTS layers
webServicesOptions.proxyUrl String Proxy URL to avoid cross-domain problems, if not already set in mapOptions. Mandatory to import WMS and WMTS layer.
webServicesOptions.noProxyDomains Array(String) Proxy will not be used for this list of domain names. Only use if you know what you're doing (if not already set in mapOptions)
defaultStyles Object Styles to apply by default to imported KML or GPX layers
defaultStyles.KML Object Styles to apply by default to imported KML layers
defaultStyles.KML.markerSrc String URL of a marker image (for KML points styling). Default is an orange marker.
defaultStyles.KML.markerXAnchor Float Position of marker anchor in X from left of the image expressed in proportion of 1 (for KML points styling). Default is 25.5
defaultStyles.KML.markerYAnchor Float Position of marker anchor in Y from top of the image expressed in proportion of 1 (for KML points styling). Default is 38
defaultStyles.KML.strokeColor String Stroke color for KML lines styling (RGB hex value). Default is "#002A50"
defaultStyles.KML.strokeWidth Number Stroke width in pixels for KML lines styling. Default is 4
defaultStyles.KML.strokeOpacity Number Stroke opacity for KML lines styling (alpha value between 0:transparent and 1:opaque). Default is 0.8
defaultStyles.KML.polyFillColor String KML polygons fill color (RGB hex value). Default is "#00B798"
defaultStyles.KML.polyFillOpacity Number KML polygons fill opacity (alpha value between 0:transparent and 1:opaque). Default is 0.5
defaultStyles.GPX Object Styles to apply by default to imported GPX layers
defaultStyles.GPX.markerSrc String URL of a marker image (for GPX waypoints styling). Default is an orange marker.
defaultStyles.GPX.markerXAnchor Float Position of marker anchor in X from left of the image expressed in proportion of 1 (for GPX waypoints styling). Default is 25.5
defaultStyles.GPX.markerYAnchor Float Position of marker anchor in Y from top of the image expressed in proportion of 1 (for GPX waypoints styling). Default is 38
defaultStyles.GPX.strokeColor String Stroke color for GPX routes or tracks styling (RGB hex value). Default is "#002A50"
defaultStyles.GPX.strokeWidth Number Stroke width in pixels for GPX routes or tracks styling. Default is 4
defaultStyles.GPX.strokeOpacity Number Stroke opacity for GPX routes or tracks styling (alpha value between 0:transparent and 1:opaque). Default is 0.8
defaultStyles.GeoJSON Object Styles to apply by default to imported GeoJSON layers
defaultStyles.GeoJSON.markerSrc String URL of a marker image (for GeoJSON points styling). Default is an orange marker.
defaultStyles.GeoJSON.markerXAnchor Float Position of marker anchor in X from left of the image expressed in proportion of 1 (for GeoJSON points styling). Default is 25.5
defaultStyles.GeoJSON.markerYAnchor Float Position of marker anchor in Y from top of the image expressed in proportion of 1 (for GeoJSON points styling). Default is 38
defaultStyles.GeoJSON.strokeColor String Stroke color for GeoJSON lines styling (RGB hex value). Default is "#002A50"
defaultStyles.GeoJSON.strokeWidth Number Stroke width in pixels for GeoJSON lines styling. Default is 4
defaultStyles.GeoJSON.strokeOpacity Number Stroke opacity for GeoJSON lines styling (alpha value between 0:transparent and 1:opaque). Default is 0.8
defaultStyles.GeoJSON.polyFillColor String GeoJSON polygons fill color (RGB hex value). Default is "#00B798"
defaultStyles.GeoJSON.polyFillOpacity Number GeoJSON polygons fill opacity (alpha value between 0:transparent and 1:opaque). Default is 0.5
defaultStyles.MapBox Object Styles to apply by default to imported MapBox layers

Options for "length" control

Specific 2D options

property Type Description
div String / DOMElement Target HTML element container or its id. Default is chosen by map implementation.
styles Object Styles to use to display the distance
styles.pointer Object Pointer (circle) style while measuring
styles.pointer.strokeColor String Stroke color
styles.pointer.strokeWidth Number Stroke width in pixels
styles.pointer.radius Number Circle radius in pixels
styles.pointer.fillColor String Circle fill color
styles.start Object Styles to use to display the distance while measuring
styles.start.strokeColor String Stroke color
styles.start.strokeWidth Number Stroke width in pixels
styles.start.strokeLineDash Array(Number) Line dash pattern : line and spaces widths
styles.finish Object Styles to use to display the distance when measure is finished
styles.finish.strokeColor String Stroke color
styles.finish.strokeWidth Number Stroke width in pixels
styles.finish.strokeLineDash Array(Number) Line dash pattern : line and spaces widths
geodesic Boolean If true (default), use geodesic method to compute the distance

Options for "area" control

Specific 2D options

property Type Description
div String / DOMElement Target HTML element container or its id. Default is chosen by map implementation.
styles Object Styles to use to display the polygon area
styles.pointer Object Pointer (circle) style while measuring
styles.pointer.strokeColor String Stroke color
styles.pointer.strokeWidth Number Stroke width in pixels
styles.pointer.radius Number Circle radius in pixels
styles.pointer.fillColor String Circle fill color
styles.start Object Styles to use to display the polygon area while measuring
styles.start.strokeColor String Stroke color
styles.start.strokeWidth Number Stroke width in pixels
styles.start.strokeLineDash Array(Number) Line dash pattern : line and spaces widths
styles.start.fillColor String Polygon fill color
styles.finish Object Styles to use to display the polygon area when measure is finished
styles.finish.strokeColor String Stroke color
styles.finish.strokeWidth Number Stroke width in pixels
styles.finish.strokeLineDash Array(Number) Line dash pattern : line and spaces widths
styles.finish.fillColor String Polygon fill color
geodesic Boolean If true (default), use geodesic method to compute the distance

Options for "azimuth" control

Specific 2D options

property Type Description
div String / DOMElement Target HTML element container or its id. Default is chosen by map implementation.
styles Object Styles to use to display the azimuth line
styles.pointer Object Pointer (circle) style while measuring
styles.pointer.strokeColor String Stroke color
styles.pointer.strokeWidth Number Stroke width in pixels
styles.pointer.radius Number Circle radius in pixels
styles.pointer.fillColor String Circle fill color
styles.start Object Styles to use to display the azimuth line while measuring
styles.start.strokeColor String Stroke color
styles.start.strokeWidth Number Stroke width in pixels
styles.start.strokeLineDash Array(Number) Line dash pattern : line and spaces widths
styles.finish Object Styles to use to display the azimuth line when measure is finished
styles.finish.strokeColor String Stroke color
styles.finish.strokeWidth Number Stroke width in pixels
styles.finish.strokeLineDash Array(Number) Line dash pattern : line and spaces widths
geodesic Boolean If false (default), not use geodesic method to compute the distance

Options for "elevationpath" control

Specific 2D options

property Type Description
div String / DOMElement Target HTML element container or its id. Default is chosen by map implementation.
styles Object Styles to use to display the polygon area
styles.pointer Object Pointer (circle) style while measuring
styles.pointer.strokeColor String Stroke color
styles.pointer.strokeWidth Number Stroke width in pixels
styles.pointer.radius Number Circle radius in pixels
styles.pointer.fillColor String Circle fill color
styles.start Object Styles to use to display the polygon area while measuring
styles.start.strokeColor String Stroke color
styles.start.strokeWidth Number Stroke width in pixels
styles.start.strokeLineDash Array(Number) Line dash pattern : line and spaces widths
styles.start.fillColor String Polygon fill color
styles.finish Object Styles to use to display the polygon area when measure is finished
styles.finish.strokeColor String Stroke color
styles.finish.strokeWidth Number Stroke width in pixels
styles.finish.strokeLineDash Array(Number) Line dash pattern : line and spaces widths
styles.finish.fillColor String Polygon fill color
styles.marker Object Style for marker displayed on map when the user follows the elevation path.
styles.marker.src String URL of a marker image.
styles.marker.xAnchor Float position of marker anchor in X from left of the image expressed in proportion of 1.
styles.marker.yAnchor Float position of marker anchor in Y from top of the image expressed in proportion of 1.
elevationPathOptions Object elevation path service options. See Gp.Services.getAltitude() for available options
displayProfileOptions Object Options for displaying the profile
displayProfileOptions.apply Function function to display profile if you want to cutomise it. By default, built-in DISPLAY_PROFILE_BY_DEFAULT() is used. You may also provide your own function using the same signature.
displayProfileOptions.target Object DOM container to use to display the profile.

Options for "search" control

Specific 2D options

property Type Description
div String / DOMElement Target HTML element container or its id. Default is chosen by map implementation.
maximised Boolean if the control has to be opened or not.
resources Object resources to be used by geocode and autocompletion services
resources.geocode Array(String) resources geocoding, by default : ["PositionOfInterest", "StreetAddress"]
resources.autocomplete Array(String) resources autocompletion, by default : ["PositionOfInterest", "StreetAddress"]
displayAdvancedSearch Boolean True to display advanced search tools. Default is false (not displayed)
advancedSearch Object advanced search options for geocoding (filters). Properties can be found among geocode options.filterOptions (see https://ignf.github.io/geoportal-access-lib/latest/jsdoc/module-Services.html#~geocode)
geocodeOptions Object options of geocode service (see https://ignf.github.io/geoportal-access-lib/latest/jsdoc/module-Services.html#~geocode)
autocompleteOptions Object options of autocomplete service (see https://ignf.github.io/geoportal-access-lib/latest/jsdoc/module-Services.html#~autoComplete)

Options for "reversesearch" control

Specific 2D options

property Type Description
div String / DOMElement Target HTML element container or its id. Default is chosen by map implementation.
maximised Boolean if the control has to be opened or not.
resources Array(String) resources geocoding, by default : ["PositionOfInterest", "StreetAddress"]
displayAdvancedSearch Boolean False to disable advanced search tools (it will not be displayed). Default is true (displayed)
delimitations Array(String) delimitations for reverse geocoding, by default : ["Point", "Circle", "Extent"]. Possible values are : "Point", "Circle", "Extent". Delimitations will be displayed in the same order in widget list.
reverseGeocodeOptions Object reverse geocode service options. see https://ignf.github.io/geoportal-access-lib/latest/jsdoc/module-Services.html#~reverseGeocode to know all reverse geocode options.

Options for "drawing" control

Specific 2D options

property Type Description
div String / DOMElement Target HTML element container or its id. Default is chosen by map implementation.
maximised Boolean if the control has to be opened or not.
layer String layerId to be used by drawing tool. If none, an empty layer will be created, with id : "drawing-xxx".
tools Object tools to be proposed by drawing tools box. All tools will be proposed by default.
tools.points Boolean Display points drawing tool
tools.lines Boolean Display lines drawing tool
tools.polygons Boolean Display polygons drawing tool
tools.text Boolean Display text drawing tool
tools.remove Boolean Display feature removing tool
tools.display Boolean Display style editing tool
tools.edit Boolean Display editing tool
tools.export Boolean Display exporting tool
labels Object labels to be used instead of defaults for drawing tools.
labels.control String Label for Control
labels.points String Label for points drawing tool
labels.lines String Label for lines drawing tool
labels.polygons String Label for polygons drawing tool
labels.text String Label for text drawing tool
labels.edit String Label for editing tool
labels.display String Label for style editing tool
labels.remove String Label for feature removing tool
labels.export String Label for exporting tool.
labels.exportTitle String Title for exporting tool.
labels.applyToObject String Label for apply to abject button.
labels.setAsDefault String Label for set as default style button.
labels.strokeColor String Label for stroke color.
labels.strokeWidth String Label for stroke width.
labels.fillColor String Label for fill color.
labels.fillOpacity String Label for fillOpacity.
markersList Array(Object) Array of markers urls and offsets to be used for points styling.
markersList.src String URL of a marker image.
markersList.xAnchor Float position of marker anchor in X from left of the image expressed in proportion of 1.
markersList.yAnchor Float position of marker anchor in Y from top of the image expressed in proportion of 1.
defaultStyles Object Styles to apply by default to drawn features.
defaultStyles.textFillColor String Text fill color for labels (RGB hex value).
defaultStyles.textStrokeColor String Text surrounding color for labels (RGB hex value).
defaultStyles.strokeColor String Stroke color (RGB hex value).
defaultStyles.polyFillColor String Polygons fill color (RGB hex value).
defaultStyles.polyFillOpacity Number Polygon fill opacity (alpha value between 0:transparent and 1:opaque).
defaultStyles.strokeWidth Number Stroke width in pixels.
cursorStyle Object cursor (circle) style when drawing or editing.
cursorStyle.fillColor String Cursor fill color.
cursorStyle.strokeColor String Cursor stroke color.
cursorStyle.strokeWidth String Cursor surrounding stroke width.
cursorStyle.radius String Cursor radius.

Options for "attributions" control

Common 2D/3D options

property Type Description
div String / DOMElement Target HTML element container or its id. Default is chosen by map implementation.
maximised Boolean if the control has to be opened or not.
TODO
  • finish description for tile vector format (layerimport control)