Geoportal Extension for OpenLayers 3 API Reference

Class: Route


Route Control.

new Route(options)

Ol3/Controls/Route.js, line 74
Name Type Description
options Object

route control options

Name Type Default Description
apiKey String optional

API key for services call (route and autocomplete services), mandatory if autoconf service has not been charged in advance

collapsed Boolean true optional

Specify if widget has to be collapsed (true) or not (false) on map loading. Default is true.

exclusions Object {toll : false, tunnel : false, bridge : false} optional

list of exclusions with status (true = checked). By default : no exclusions checked.

graphs Array ["Voiture", "Pieton"] optional

list of resources, by default : ["Voiture", "Pieton"]. The first element is selected.

markersOpts Object optional

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 optional

marker base64 encoded url (ex "data:image/png;base64,...""). Mandatory for a custom marker

markersOpts[property].offset Array optional

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

routeOptions Object {} optional

route service options. see Gp.Services.route() to know all route options.

autocompleteOptions Object {} optional

autocomplete service options. see Gp.Services.autoComplete() to know all autocomplete options

var route = ol.control.Route({
     collapsed : true
     exclusions : {
        "toll" : true,
        "bridge" : false,
        "tunnel" : true
     graphs : ['Pieton', 'Voiture'],
     markersOpts : {
         departure : {
             url : "...",
             offset : [0,0]
         stages : {
             url : "...",
             offset : [0,0]
         arrival : {
             url : "...",
             offset : [0,0]
     autocompleteOptions : {},
     routeOptions : {}


  • ol.control.Control



{Boolean} specify if Route control is collapsed (true) or not (false)



Ol3/Controls/Route.js, line 132

Returns true if widget is collapsed (minimized), false otherwise

- true if widget is collapsed


Ol3/Controls/Route.js, line 162

Get vector layer where geoJson route is drawn

- ol.layer.Vector route layer


Ol3/Controls/Route.js, line 141

Collapse or display widget main container

Name Type Description
collapsed Boolean

True to collapse widget, False to display it


Ol3/Controls/Route.js, line 171

Overwrite OpenLayers setMap method

Name Type Description
map ol.Map