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 108
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

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(false);
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 : false
}});

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 803

Get container

onChangeInputDesc(e)

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

Click

onChangeInputName(e)

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

Click

onChangeRadioFormat(e)

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

Click

onClickButtonExport(e)

Controls/Export/Export.js, line 687

...

Name Type Description
e *

Click

onClickButtonToggleOptions(e)

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

Click

render()

Controls/Export/Export.js, line 282

Render DOM

setControl(control)

Controls/Export/Export.js, line 812

...

Name Type Description
control Object

...

setDescription(desc)

Controls/Export/Export.js, line 868

...

Name Type Description
desc String

...

setDownload(value)

Controls/Export/Export.js, line 951

...

Name Type Description
value Boolean

...

setFormat(format)

Controls/Export/Export.js, line 830

...

Name Type Description
format String

...

setKind(type)

Controls/Export/Export.js, line 890

...

Name Type Description
type String

...

setLayer(layer)

Controls/Export/Export.js, line 942

...

Name Type Description
layer *

...

setMenu(active)

Controls/Export/Export.js, line 915

...

Name Type Description
active Boolean

...

setName(name)

Controls/Export/Export.js, line 859

...

Name Type Description
name String

...

setTarget(target)

Controls/Export/Export.js, line 821

...

Name Type Description
target DOMElement

...

setTitle(title)

Controls/Export/Export.js, line 877

...

Name Type Description
title String

...