Geoportal Controls Factory to be used together with Leaflet Maps.
Example
var layerSwitcher = L.geoportalControl.LayerSwitcher(options);
Methods
-
staticElevationPath(options){L.geoportalControl.ElevationPath}
Leaflet/Controls/Controls.js, line 313 -
Factory function for ElevationPath Control creation.
Name Type Description options Object options for function call.
Name Type Default Description apiKey String optional API key for elevation service call, mandatory if configuration service has not been loaded in advance. See "Configuration de l'accès à la plateforme Géoportail" documentation chapter for more information.
position String optional position of component into the map, 'topleft' by default. See L.Control options for available values.
ssl Boolean true optional use of ssl or not (default true, service requested using https protocol)
active Boolean false optional specify if control should be actived at startup. Default is false.
stylesOptions Object DEFAULT_STYLES optional Styles to use when drawing. see leaflet options for available properties.
elevationPathOptions Object {} optional elevation path service options. See options for available options
displayProfileOptions Object {} optional profile options.
Name Type Default Description apply function optional function to display profile if you want to cutomise it. By default, DISPLAY_PROFILE_BY_DEFAULT() is used. Helper functions to use with D3 DISPLAY_PROFILE_LIB_D3() or AmCharts DISPLAY_PROFILE_LIB_AMCHARTS() frameworks are also provided. You may also provide your own function.
target Object optional DOM container to use to display the profile.
greaterSlope Boolean true optional display the greater slope into the graph
meanSlope Boolean true optional display the mean slope into the graph
ascendingElevation Boolean true optional display the ascending elevation into the graph
descendingElevation Boolean true optional display the descending elevation into the graph
currentSlope Boolean true optional display current slope value on profile mouseover
Returns:
Object
Example
var e = L.geoportalControl.ElevationPath({ active : false position : "topleft" stylesOptions : {}, elevationPathOptions : {}, displayProfileOptions : { apply : L.geoportalControl.DISPLAY_PROFILE_LIB_AMCHARTS target : null, // by default meanSlope : true, // by default greaterSlope : true, // by default ascendingElevation : false, descendingElevation : false, currentSlope : false } });
-
staticIsocurve(options){L.geoportalControl.Isocurve}
Leaflet/Controls/Controls.js, line 66 -
Factory function for Isocurve Control creation.
Name Type Description options Object Isocurve control options
Name Type Default Description apiKey String optional API key for services call (isocurve and autocomplete services). The key "calcul" is used by default.
position String optional position of component into the map, 'topleft' by default. See L.Control options for available values.
collapsed Boolean true optional Specify if widget has to be collapsed (true) or not (false) on map loading. Default is true.
ssl Boolean true optional use of ssl or not (default true, service requested using https protocol)
exclusions Object {"toll" : false, "tunnel" : false, "bridge" : false} optional list of exclusions with status (true = checked), by default : ["toll":false, "tunnel":false, "bridge":false].
graphs Array ["Voiture", "Pieton"] optional list of graph resources to be used for isocurve calculation, by default : ["Voiture", "Pieton"]. The first element is selected.
methods Array ["time", "distance"] optional list of methods, by default : ["time", "distance"]. The first element is selected by default.
directions Array ["departure", "arrival"] 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. see Gp.Services.isoCurve
autocompleteOptions Object {} optional autocomplete service options. see Gp.Services.autoComplete
Returns:
Object
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 20 -
Factory function for LayerSwitcher Control creation.
Name Type Description options Object options for function call.
Name Type Default Description position String optional position of component into the map, 'topleft' by default. See L.Control options for available values.
collapsed Boolean true 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
Returns:
Object
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 104 -
Factory function for Geoportal MousePosition Control creation.
Name Type Description options Object options for function call.
Name Type Default Description apiKey String optional API key. The "calcul" key is used by default.
position String optional position of component into the map, 'bottomleft' by default. See L.Control options for available values.
collapsed Boolean true optional collapse mode, false by default
ssl Boolean true optional use of ssl or not (default true, service requested using https protocol)
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"
geoBBox Object optional Aera covered by the system (WGS84 coordinates).
Name Type Description right Number Right bound.
left Number Left bound.
top Number Top bound.
bottom Number Bottom bound.
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 coordinatesdisplayAltitude Boolean true optional active/desactivate the altitude panel, if desactivate, have just the coordinate panel, true by default
displayCoordinates Boolean true optional active/desactivate the coordinate panel, if desactivate, have just the altitude panel, true by default
editCoordinates Boolean false optional If true, coordinates from the MousePosition control can be edited by users to re-center the view. False by default.
altitude Object optional elevation configuration
Name Type Description serviceOptions Object optional options of elevation service. see Gp.Services.getAltitude
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 90000Returns:
Object
Example
var MousePosition = L.geoportalControl.MousePosition({ position : 'bottomleft', collapsed : false, displayAltitude : true, editCoordinates : false, 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 172 -
Factory function for Geoportal ReverseGeocode Control creation.
Name Type Description options Object ReverseGeocoding control options
Name Type Default Description apiKey String optional API key for services call (reverse geocode service). The "calcul" key is used by default.
position String optional position of component into the map, 'topleft' by default. See L.Control options for available values.
collapsed Boolean true optional Specify if widget has to be collapsed (true) or not (false) on map loading. Default is true.
ssl Boolean true optional use of ssl or not (default true, service requested using https protocol)
resources Array ["StreetAddress", "PositionOfInterest", "CadastralParcel"] optional resources for geocoding, by default : ["StreetAddress", "PositionOfInterest"]
delimitations Array ["Point", "Circle", "Extent"] optional delimitations for reverse geocoding, by default : ["Point", "Circle", "Extent"]
ReverseGeocodeOptions Object {} optional reverse geocode service options. see Gp.Services.reverseGeocode to know all reverse geocode options.
Fires:
Returns:
Object
Example
var reverse = L.geoportalControl.ReverseGeocode({ collapsed : false, position : "topright", resources : ["StreetAddress", "PositionOfInterest"], delimitations : ["Point", "Circle"], reverseGeocodeOptions : {} }); reverse.on("reverse:onclickresult", function (e) { console.log(e.data): });
-
staticRoute(options){L.geoportalControl.Route}
Leaflet/Controls/Controls.js, line 205 -
Factory function for Geoportal Route Control creation.
Name Type Description options Object options for function call.
Name Type Default Description apiKey String optional API key. The "calcul" key is used by default.
position String "topleft" optional position of component into the map, 'topleft' by default. See L.Control options for available values.
collapsed Boolean false optional collapse mode, false by default
ssl Boolean true optional use of ssl or not (default true, service requested using https protocol)
disableReverse Boolean false optional whether to enable/disable the reverse geocoding when entering points.
Active by default. But, you can disable it when entering with the "ctrl" key on the keyboardexclusions Object {"toll" : false, "tunnel" : false, "bridge" : false} optional list of exclusions with status
graphs Array ["Voiture", "Pieton"] optional list of resources, by default : ["Voiture", "Pieton"], and the first element is selected.
autocompleteOptions Object {} optional options of autocomplete service. see Gp.Services.autoComplete
routeOptions Object {} optional options of route service. see Gp.Services.route
Returns:
Object
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 242 -
Factory function for Geoportal SearchEngine Control creation.
Name Type Description options Object control options
Name Type Default Description apiKey String optional API key. The "calcul" key is used by default.
collapsed Boolean false optional collapse mode
ssl Boolean true optional use of ssl or not (default true, service requested using https protocol)
position String "topleft" optional position of component into the map. See L.Control options for available values.
placeholder String "Rechercher un lieu, une adresse" optional set placeholder in search bar
displayMarker Boolean true optional set a marker on search result
markerStyle String | Object "blue" optional set a marker style. Currently possible values are "blue" (default value), "orange", "red" and "green". But you can use an L.Icon object (see L.Icon )
displayInfo Boolean true optional get informations on popup marker
zoomTo String | Numeric | function optional zoom to results, by default, current zoom.
possible values : "auto", any fixed zoom level or a function retruning a zoom :``` zoomTo : function (info) { // do some stuff... return zoom; // required : return the zoom level ! } With parameter 'info' : { type : "PositionOfInterest" | "StreetAddress" | ... service : "SuggestedLocation" | "GeocodedLocation" fields : { // fields of service response } } ```
apiKey String optional API key. The "calcul" key is used by default.
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. see Gp.Services.geocode
autocompleteOptions Object optional options of autocomplete service. see Gp.Services.autoComplete
Name Type Default Description serviceOptions Object optional options of autocomplete service
triggerGeocode Boolean false optional trigger a geocoding request if the autocompletion does not return any suggestions, false by default
triggerDelay Number 1000 optional waiting time before sending the geocoding request, 1000ms by default
Fires:
Returns:
Object
Example
var SearchEngine = L.geoportalControl.SearchEngine({ position : "topright", collapsed : true, zoomTo : "auto", displayInfo : true, displayAdvancedSearch : true, resources : ["PositionOfInterest", "StreetAddress"], advancedSearch : { PositionOfInterest : [{name : "municipality", title : "Ville"}], StreetAddress : [{...}], CadastralParcel : null, }, apiKey : "zfgzrgffg57rfg8ar7gr4g5r4", geocodeOptions : {}, autocompleteOptions : {} }); SearchEngine.on("searchengine:autocomplete:click", function (e) { console.log(e.data): }); SearchEngine.on("searchengine:geocode:click", function (e) { console.log(e.data): });