Geoportal Extension for OpenLayers API Reference
The Geoportal Extension for OpenLayers provides additionnal javascript functionalities (Sources, Layers and Controls) making access to french geoportal webservices easier when using OpenLayers javascript library.
This extension is not standalone and has to be used together with OpenLayers library. In a web page, you thus have to include both OpenLayers and Geoportal Extension resources. For instance :
<!-- OpenLayers -->
<link rel="stylesheet" href="path/to/ol/ol.css" />
<script src="path/to/ol/ol.js"></script>
<!-- Geoportal Extension for OpenLayers -->
<script src="path/to/GpPluginOpenLayers.js" data-key="{your-geoportal-access-key}"></script>
<link rel="stylesheet" href="path/to/GpPluginOpenLayers.css" />
NB : to have complete access to this extension functionnalities, you need to freely provide a geoportal access key among the one available here : . Use it 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 Sources
Sources provided by the Geoportal Extension are additionnal OpenLayers Sources that give simple access to Geoportal data that can then be used to feed OpenLayers layers.
Geoportal Source | Description |
---|---|
ol.source.GeoportalWMS | Provides access to Geoportal or INSPIRE WMS web services. |
ol.source.GeoportalWMTS | Provides access to Geoportal WMTS web service. |
Geoportal Layers
Layers provided by the Geoportal Extension are additionnal OpenLayers layers already connected to previous Geoportal Extension sources that can be added to an OpenLayers Map like any other OpenLayers layer.
Geoportal Layer | Description |
---|---|
ol.layer.GeoportalWMS | Provides access to Geoportal or INSPIRE WMS web services. |
ol.layer.GeoportalWMTS | Provides access to Geoportal WMTS web service. |
Geoportal Controls
Controls provided by the Geoportal Extension are additionnal OpenLayers controls that, when added to an OpenLayers Map, allows user to interact with it.
Geoportal Control | Description |
---|---|
ol.control.GeoportalAttribution | Is a substitute for built in ol.control.Attribution. It has the additionnal capability of handling geoportal dynamic attributions depending on zoom level and positionning of the map. |
ol.control.LayerSwitcher | Allows users to manage layer organisation of the map |
ol.control.GeoportalMousePosition | Is a substitute for built in ol.control.MousePosition. It has the additionnal capability of displaying elevation of Mouse Position based on elevation service of the Geoportal Platform. |
ol.control.SearchEngine | Allows users to search and display locations on a map using autocompletion service and geocoding service of the Geoportal Platform. |
ol.control.ReverseGeocode | Allows users to find locations by clicking on a map using geocoding service of the Geoportal Platform. |
ol.control.Route | Allows users to compute and display routes on a Map using routing service of the Geoportal Platform. |
ol.control.Isocurve | Allows users to compute and display Isochrone or Isodistance curves on a Map using isochron/isodistance service of the Geoportal Platform. |
ol.control.Drawing | Provides tools to users for making and saving annotations on a map. |
ol.control.LayerImport | Provides tools to users for their own geographical data on a map. |
ol.control.MeasureArea | Allows users to compute an area measure. |
ol.control.MeasureLength | Allows users to compute a length measure. |
ol.control.MeasureAzimuth | Allows users to compute an azimuth measure. |
ol.control.ElevationPath | Allows users to compute an altimetric profile using elevation service of the Geoportal Platform. |
ol.control.Export | Allows users to export calculation of Isocurve, Route or ElevationPath controls in GPX, KML or GeoJSON formats |