Geoportal Extension for Leaflet API Reference

Index

API Reference

The Geoportal Extension for Leaflet provides additionnal javascript functionalities (Coordinate Reference Systems, Layers and Controls) making access to french geoportal webservices more easier when using Leaflet javascript library.

This extension is not standalone and has to be used together with Leaflet library. In a web page, you thus have to include both Leaflet and Geoportal Extension resources. For instance :

<!-- Leaflet -->
<link rel="stylesheet" href="path/to/leaflet.css" />
<script src="path/to/leaflet.js"></script>

<!-- Geoportal Extension for Leaflet -->
<script src="path/to/GpPluginLeaflet.js" data-key="{your-geoportal-access-key}"></script>
<link rel="stylesheet" href="path/to/GpPluginLeaflet.css" />

NB : to have complete access to this extension functionnalities, you need to provide your geoportal access key (obtained here) either when loading extension script (using the data-key attribute) or by conditinning their use to the onSuccess callback function of a Gp.Services.GetConfig() call with that key. Otherwhise some functionalities may not work as announced.

Geoportal CRS

Additionnaly to built in Leaflet Coordinate Reference Systems (CRS) the Geoportal Extension provides Lambert 93 (EPSG:2154) CRS definition, useful for Lambert 93 WMTS Geoportal Layers display.

Geoportal CRS Description
L.geoportalCRS.EPSG2154 Lambert 93 (EPSG:2154) CRS.

The integration of Proj4Leaflet and Proj4js libraries in the Geoportal extension allows developpers to define further CRS if they need.

Geoportal Layers

Layers provided by the Geoportal Extension are additionnal Leaflet tiled layers that can be added to an Leaflet Map like any other Leaflet layer.

Geoportal Layer Description
L.geoportalLayer.WMS Provides access to Geoportal or INSPIRE WMS web services.
L.geoportalLayer.WMTS Provides access to Geoportal WMTS web service.

Geoportal Controls

Controls provided by the Geoportal Extension are additionnal Leaflet controls that, when added to an Leaflet Map, allows user to interact with it.

Geoportal Control Description
L.geoportalControl.LayerSwitcher Allows users to manage layer organisation of the map
L.geoportalControl.MousePosition Allows users to know coordinates of the mouse displayed in various Coordinates Reference Systems. It has the additionnal capability of displaying elevation of Mouse Position based on elevation service of the Geoportal Platform.
L.geoportalControl.SearchEngine Allows users to search and display locations on a map using autocompletion service and geocoding service of the Geoportal Platform.
L.geoportalControl.ReverseGeocode Allows users to find locations by clicking on a map using geocoding service of the Geoportal Platform.
L.geoportalControl.Route Allows users to compute and display routes on a Map using routing service of the Geoportal Platform.
L.geoportalControl.Isocurve Allows users to compute and display Isochrone or Isodistance curves on a Map using isochron/isodistance service of the Geoportal Platform.
L.geoportalControl.ElevationPath Allows users to compute an altimetric profile using elevation service of the Geoportal Platform.