Geoportal Resources Access API Reference

Tutorial: optimize-getconfig


Optimize your geoportal access configuration

To use Geoportal resources, you need an access key which can be obtained on the web site.

You can speed up your geoportal application by caching your the configuration associated to your geoportal access key on your server.

Here is how you can do.

1. Get the configuration file

Fill the input text below with your geoportal access key ; if you want Geoportal Services to be accessed by default in https, check the "https access" check box.

Click the "Get Config File" button.

https access

When prompted, save the file "autoconf.json" (or "autoconf-https.json") on your platform.

2. Configure geoportal functions to use that file

Be it Geoportal access lib, Geoportal extensions or Geoportal SDK, you can use that file to configure your application :

With Geoportal access lib

Use it as a value of the serverUrl param of the Gp.Services.getConfig() function (instead of the apiKey param) :

the Gp.Services.getConfig({
    serverUrl : "path/to/autoconf.json",
    callbackSuffix : "",
}) ;

With Geoportal extensions

Use it with the data-url attribute of the script tag used to load the Geoportal extension (instead of the data-key attribute) :

<script type="text/javascript" src="path/to/GpPluginLeaflet.js" data-url="path/to/autoconf.json"></script>
<!-- or -->
<script type="text/javascript" src="path/to/GpPluginOpenLayers.js" data-url="path/to/autoconf.json"></script>

With Geoportal SDK

Use it as a value of the configUrl param of the Gp.MapOptions object used in the Gp.Map.load() function (instead of the apiKey param) :

        configUrl : "path/to/autoconf.json",
) ;