Geoportal Extension for OpenLayers
API Reference

Class: Export

ol.control.Export

button that will plug into a widget and export the contents of the calculation

new Export(options)

Controls/Export/Export.js, line 120
Name Type Description
options Object

options for function call.

Name Type Default Description
id Number optional

Ability to add an identifier on the widget (advanced option)

download String "true" optional

triggering the download of the file

format String "geojson" optional

geojson / kml / gpx

name String "export" optional

export name file

description String "export" optional

export description put into file

title String "Exporter" optional

button name

kind String "secondary" optional

button type : primary | secondary | tertiary

menu Boolean false optional

displays the menu

menuOptions Object optional

options of the menu.

Name Type Default Description
outside Boolean false optional

displays all element outside of menu

above Boolean false optional

displays menu above or not of the button

labelName Boolean true optional

displays the label name

labelDesc Boolean true optional

displays the label description

selectFormat Boolean true optional

displays the select format

direction String "row" optional

buttons and menus layout

icons Object optional

icons

Name Type Default Description
menu String "\u2630 " optional

displays the menu icon, or otherwise left blank if you don't want it

button String "export" optional

displays the button icon : save or export icon, or otherwise left blank if you don't want it

callback function optional

with a callback, the implementation is your responsibility

target DOMElement optional

target where the button will plug in. By default, the target is 'container-buttons-plugin' into the wikdget

control Object optional

instance of control

layer Object optional

the layer instance is retrieved from the control, but you can defined it

Fires:
  • button:clicked
Example
// pluggued widget Export into control Isocurve
var iso = new ol.control.Isocurve();
map.addControl(iso);

// method : call render()
var export = new ButtonExport();
export.setDownload(true);
export.setControl(iso);
export.setTarget();
export.setName("export");
export.setFormat("geojson");
export.setDescription("Export Isochrone");
export.setTitle("Exporter");
export.setMenu(true);
export.setMenuOptions({
  outside : false,
  labelName : true,
  labelDesc : true,
  selectFormat : true
});
export.render(); // <-- direct call to render function !
export.on("button:clicked", (data) => { console.log(data); });

// method : call map.addControl()
var export = new ButtonExport();
export.setDownload(true);
export.setControl(iso);
export.setTarget();
export.setName("export");
export.setFormat("geojson");
export.setDescription("Export Isochrone");
export.setTitle("Exporter");
export.setKind("secondary");
export.setMenu(false);
export.on("button:clicked", (data) => { console.log(data); });
map.addControl(export); // <-- using the OpenLayers mechanism, don't call to render function !

// use control options instead of setters
var export = new ButtonExport({
  download : true,
  control : iso,
  target : ,
  name : "export",
  description : "Export Isochrone",
  format : "geojson",
  title : "Exporter",
  menu : false,
  callback : (content, layer) => {
     console.log(content, layer);
  }
});
map.addControl(export);

// method with passing option into the control Isocurve
var iso = new ol.control.Isocurve({ export : true });
// with control options :
var iso = new ol.control.Isocurve({ export : {
  download : false,
  name : "save-iso",
  format : "geojson",
  title : "Sauvegarde",
  menu : true
}});

Members

EXPORT_ISOCHRON

Response to the export of the isochron calculation
(only for jsdoc)

See:
Example
// GeoJSON format
{
   "type":"FeatureCollection",
   "features":[...],
   "geoportail:compute":{
      "transport":"Pieton",
      "computation":"time",
      "exclusions":[

      ],
      "direction":"departure",
      "point":[ 2.587835382718464, 48.84192678293002 ],
      "results":{
         "message":"",
         "id":"",
         "location":{
            "x":"2.587835382718464",
            "y":"48.84192678293002"
         },
         "srs":"EPSG:4326",
         "geometry":{
            "type":"Polygon",
            "coordinates":[[...]]
         },
        "time":180,
        "distance":""
     }
   }
}

EXPORT_PROFILE

Response to the export of the profile calculation
(only for jsdoc)

See:
Example
// GeoJSON format
{
 "type":"FeatureCollection",
  "features":[...],
  "geoportail:compute":{
     "greaterSlope":76,
     "meanSlope":7,
     "distancePlus":84,
     "distanceMinus":48,
     "ascendingElevation":5,
     "descendingElevation":-4,
     "altMin":"92,04",
     "altMax":"96,71",
     "distance":163,
     "unit":"m",
     "points":[
       {
           "z":95.68,
           "lon":2.5874,
           "lat":48.8419,
           "acc":2.5,
           "dist":0,
           "slope":0
        }
     ]
  }
}

EXPORT_ROUTE

Response to the export of the route calculation
(only for jsdoc)

See:
Example
// GeoJSON format
{
  "type":"FeatureCollection",
  "features":[...],
  "geoportail:compute":{
    "points":[ [2.588024210134887, 48.84192678293002 ] ],
    "transport":"Voiture",
    "exclusions":[...],
    "computation":"fastest",
    "results":{  }
}

Methods

getContainer(){DOMElement}

Controls/Export/Export.js, line 902

Get container

onChangeInputDesc(e)

Controls/Export/Export.js, line 845
Name Type Description
e *

Click

onChangeInputName(e)

Controls/Export/Export.js, line 827
Name Type Description
e *

Click

onChangeRadioFormat(e)

Controls/Export/Export.js, line 819
Name Type Description
e *

Click

onClickButtonExport(e)

Controls/Export/Export.js, line 754

...

Name Type Description
e *

Click

onClickButtonToggleOptions(e)

Controls/Export/Export.js, line 863
Name Type Description
e *

Click

render()

Controls/Export/Export.js, line 295

Render DOM

setControl(control)

Controls/Export/Export.js, line 911

...

Name Type Description
control Object

...

setDescription(desc)

Controls/Export/Export.js, line 967

...

Name Type Description
desc String

...

setDownload(value)

Controls/Export/Export.js, line 1059

...

Name Type Description
value Boolean

...

setFormat(format)

Controls/Export/Export.js, line 929

...

Name Type Description
format String

...

setKind(type)

Controls/Export/Export.js, line 989

...

Name Type Description
type String

...

setLayer(layer)

Controls/Export/Export.js, line 1050

...

Name Type Description
layer *

...

setMenu(active)

Controls/Export/Export.js, line 1014

...

Name Type Description
active Boolean

...

setMenuOptions(opts)

Controls/Export/Export.js, line 1041

...

Name Type Description
opts Object

...

TODO
  • ...

setName(name)

Controls/Export/Export.js, line 958

...

Name Type Description
name String

...

setTarget(target)

Controls/Export/Export.js, line 920

...

Name Type Description
target DOMElement

...

setTitle(title)

Controls/Export/Export.js, line 976

...

Name Type Description
title String

...