Geoportal Extension for Leaflet API Reference

Module: Controls

L.geoportalControl

Geoportal Controls Factory to be used together with Leaflet Maps.

Example

var layerSwitcher = L.geoportalControl.LayerSwitcher(options);

Methods

staticIsocurve(options){L.geoportalControl.Isocurve}

Leaflet/Controls/Controls.js, line 78

Factory function for Isocurve Control creation.

Name Type Description
options Object

Isocurve control options

Name Type Default Description
apiKey Sting optional

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

position String optional

position of component into the map, 'topleft' by default

collapsed Boolean optional

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

exclusions Object optional

list of exclusions with status (true = checked), by default : ["toll":false, "tunnel":false, "bridge":false].

graphs Array optional

list of graph resources to be used for isocurve calculation, by default : ["Voiture", "Pieton"]. The first element is selected.

methods Array optional

list of methods, by default : ["time", "distance"]. The first element is selected by default.

directions Array optional

list of directions to be displayed, by default : ["departure", "arrival"]. The first element is selected by default.
Directions enable to specify if input location point will be used as a departure point ("departure") or as an arrival point ("arrival")

disableReverse Boolean false optional

whether to enable/disable the reverse geocoding

isocurveOptions Object optional

isocurve service options.

autocompleteOptions Object optional

autocomplete service options.

Example
var iso = L.geoportalControl.Isocurve({
     collapsed : false
     methods : ["time", "distance"],
     exclusions : {
        toll : true,
        bridge : false,
        tunnel : true
     },
     graphs : ["Pieton", "Voiture"],
     isocurveOptions : {},
     autocompleteOptions : {}
 });

staticLayerSwitcher(options){L.geoportalControl.LayerSwitcher}

Leaflet/Controls/Controls.js, line 32

Factory function for LayerSwitcher Control creation.

Name Type Description
options Object

options for function call.

Name Type Description
position String optional

position of component into the map, 'topleft' by default

collapsed Boolean optional

collapse mode, false by default

layers Array optional

list of layers to be configured. Each array element is an object, with following properties :

Name Type Description
layer Object optional

layer object

display Boolean optional

display layer in widget layer list

config Object optional

layer display config

Name Type Description
visibility String optional

layer visibility on map

title String optional

layer alias, to be displayed in widget layer list. E.g. : "Cartes IGN"

description String optional

layer description, to be displayed on title hover, or in layer information panel.

quicklookUrl String optional

link to a quick look image for this layer.

legends Array optional

array of layer legends. Each array element is an object, with following properties :

 - url (String, mandatory) : link to a legend
 - minScaleDenominator (Number, optional) : min scale denominator for legend validity.
metadata Array optional

array of layer metadata. Each array element is an object, with property url (String, mandatory) : link to a metadata

Example
layers = [
     {
         layer : wms1,
         display : false,
         config : {
             title : "test layer name 1",
             description : "test layer desc 1",
         }
     }
 ];

 options = {
     position : "topright",
     collapsed : true,
     layers : layers
 };

 var layerSwitcher = L.geoportalControl.LayerSwitcher(options);

staticMousePosition(options){L.geoportalControl.MousePosition}

Leaflet/Controls/Controls.js, line 115

Factory function for Geoportal MousePosition Control creation.

Name Type Description
options Object

options for function call.

Name Type Description
apiKey Sting optional

API key, mandatory if autoconf service has not been charged in advance

position String optional

position of component into the map, 'bottomleft' by default

collapsed Boolean optional

collapse mode, false by default

systems Array optional

list of projection systems, GEOGRAPHIC, MERCATOR, LAMB93 and LAMB2E by default
Each array element (=system) is an object with following properties :

Name Type Description
crs String

Proj4 crs alias (from proj4 defs). e.g. : "EPSG:4326". Required

label String optional

CRS label to be displayed in control. Default is crs code (e.g. "EPSG:4326")

type String optional

CRS units type for coordinates conversion : "Geographical" or "Metric". Default: "Metric"

units Array optional

list of units by system, Geographical and Metric by default
Values may be "DEC" (decimal degrees), "DMS" (sexagecimal), "RAD" (radians) and "GON" (grades) for geographical coordinates,
and "M" or "KM" for metric coordinates

displayAltitude Boolean optional

active/desactivate the altitude panel, if desactivate, have just the coordinate panel, true by default

displayCoordinate Boolean optional

active/desactivate the coordinate panel, if desactivate, have just the altitude panel, true by default

altitude Object optional

elevation configuration

Name Type Description
serviceOptions Object optional

options of elevation service

responseDelay Number optional

latency for altitude request, 500 ms by default

triggerDelay Number optional

immobilisation time of movement on the map to trigger the elevation calculation, 200 ms by default

noDataValue Number optional

value used for altitude service no data (default is -99999). In this case, "---m" will be displayed instead of "-99999m"

noDataValueTolerance Number optional

tolerance for no data value :
values in [noDataValue - noDataValueTolerance ; noDataValue + noDataValueTolerance] interval will not be displayed, but "---m" will be displayed instead.
Default is 90000

Example
var MousePosition = L.geoportalControl.MousePosition({
     position : 'bottomleft',
     collapsed : false,
     displayAltitude : true,
     altitude : {
          triggerDelay : 100,
          responseDelay : 500,
          noDataValue : -99999,
          noDataValueTolerance : 90000,
          serviceOptions : {}
     },
     systems : [
      {
         crs : L.CRS.EPSG4326,
         label : "Lon,Lat",
         type : "Geographical"
       },
      {
         crs : L.geoportalCRS.EPSG2154,
         label : "Lambert 93",
         type : "Metric"
       }
     ],
     units : ["DEC", "DMS"]
 });

staticReverseGeocode(options){L.geoportalControl.ReverseGeocode}

Leaflet/Controls/Controls.js, line 175

Factory function for Geoportal ReverseGeocode Control creation.

Name Type Description
options Object

ReverseGeocoding control options

Name Type Description
apiKey String optional

API key for services call (reverse geocode service), mandatory if autoconf service has not been charged in advance

position String optional

position of component into the map, 'topleft' by default

collapsed Boolean optional

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

resources Array optional

resources for geocoding, by default : ["StreetAddress", "PositionOfInterest"]

delimitations Array optional

delimitations for reverse geocoding, by default : ["Point", "Circle", "Extent"]

ReverseGeocodeOptions Object optional

reverse geocode service options. see http://depot.ign.fr/geoportail/bibacces/develop/doc/module-Services.html#~ReverseGeocode to know all reverse geocode options.

Example
var iso = L.geoportalControl.ReverseGeocode({
     collapsed : false,
     position : "topright",
     resources : ["StreetAddress", "PositionOfInterest"],
     delimitations : ["Point", "Circle"],
     reverseGeocodeOptions : {}
 });

staticRoute(options){L.geoportalControl.Route}

Leaflet/Controls/Controls.js, line 203

Factory function for Geoportal Route Control creation.

Name Type Description
options Object

options for function call.

Name Type Description
apiKey Sting optional

API key, mandatory if autoconf service has not been charged in advance

position String optional

position of component into the map, 'topleft' by default

collapsed Boolean optional

collapse mode, false by default

exclusions Object optional

list of exclusions with status

graphs Array optional

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

autocompleteOptions Object optional

options of autocomplete service

routeOptions Object optional

options of route service

Example
var route = L.geoportalControl.Route({
     position : "topright",
     collapsed : true,
     exclusions : {
        "toll" : true,
        "bridge" : false,
        "tunnel" : true
     },
     graphs : ['Pieton', 'Voiture'],
     autocompleteOptions : {},
     routeOptions : {}
 });

staticSearchEngine(options){L.geoportalControl.SearchEngine}

Leaflet/Controls/Controls.js, line 237

Factory function for Geoportal SearchEngine Control creation.

Name Type Description
options Object

control options

Name Type Description
apiKey String optional

API key, mandatory if autoconf service has not been charged in advance

collapsed Boolean optional

collapse mode, false by default

position String optional

position of component into the map, 'topleft' by default

displayInfo Boolean optional

get informations on popup marker

apiKey Sting optional

API key, mandatory if autoconf service has not been charged in advance

resources Object optional

resources to be used by geocode and autocompletion services, by default : ["StreetAddress", "PositionOfInterest"]

displayAdvancedSearch Boolean optional

False to disable advanced search tools (it will not be displayed). Default is true (displayed)

advancedSearch Object optional

advanced search for geocoding (filters)

geocodeOptions Object optional

options of geocode service

autocompleteOptions Object optional

options of autocomplete service

Example
var SearchEngine = L.geoportalControl.SearchEngine({
     position : "topright",
     collapsed : true,
     displayInfo : true,
     displayAdvancedSearch : true,
     resources : ["PositionOfInterest", "StreetAddress"],
     advancedSearch : {
         PositionOfInterest : [{name : "municipality", title : "Ville"}],
         StreetAddress : [{...}],
         CadastralParcel : null,
     },
     apiKey : "zfgzrgffg57rfg8ar7gr4g5r4",
     geocodeOptions : {},
     autocompleteOptions : {}
 });