Geoportal Extension for OpenLayers
API Reference

Class: Export

ol.control.Export

Export button

new Export(options)

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

options for function call.

Name Type Default Description
format String "geojson" optional

geojson / kml / gpx

name String "export" optional

export name

title String "Exporter" optional

button name

menu Boolean false optional

displays the format choice menu

onExport function optional

callback

target DOMElement optional

target

control Object

instance of control

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

// method : call render()
var export = new ButtonExport();
export.setControl(iso);
export.setTarget();
export.setName("export");
export.setFormat("geojson");
export.setTitle("Exporter");
export.setMenu(false);
export.render(); // <-- direct call to render function !
export.on("export:compute", (data) => { console.log(data); });

// method : call map.addControl()
var export = new ButtonExport();
export.setControl(iso);
export.setTarget();
export.setName("export");
export.setFormat("geojson");
export.setTitle("Exporter");
export.setMenu(false);
export.on("export:compute", (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({
  control : iso,
  target : ,
  name : "export",
  format : "geojson",
  title : "Exporter",
  menu : false
});
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 : {
  name : "export",
  format : "geojson",
  title : "Exporter",
  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 603

Get container

onClickButtonExport(e)

Controls/Export/Export.js, line 541

...

Name Type Description
e *

Click

render()

Controls/Export/Export.js, line 249

Render DOM

setControl(control)

Controls/Export/Export.js, line 612

...

Name Type Description
control Object

...

setFormat(format)

Controls/Export/Export.js, line 630

...

Name Type Description
format String

...

setMenu(active)

Controls/Export/Export.js, line 681

...

Name Type Description
active Boolean

...

setName(name)

Controls/Export/Export.js, line 659

...

Name Type Description
name String

...

setTarget(target)

Controls/Export/Export.js, line 621

...

Name Type Description
target DOMElement

...

setTitle(title)

Controls/Export/Export.js, line 668

...

Name Type Description
title String

...