MapStore Training

Previous topic

MapStore Build file

Next topic

Manage Viewer Configuration

This Page

Manage Build ConfigurationΒΆ

When building MapStore all the plugins and widget used are merged together in a single file.
To specify which components to add in the build, a buildjs.cfg is used.
The buildjs.cfg has a list of every plugin, widget or library to look for when building

The buildjs.cfg file is placed in the root directory of either mapcomposer and mapmanager

../mapstore/
    mapcomposer
        buildjs.cfg
    mapmanager
        buildjs.cfg

In the following example we will add the Geolocate plugin to the build file

  1. The Geolocate plugin uses an OpenLayers Control, also called Geolocate that must be included in the build file as well
    Open the buildjs.cfg file and find the [OpenLayers.js] section
  2. After the include= line add the following

    OpenLayers/Control/Geolocate.js
    
  3. In the same file find the [gxp.js] section and, again, under the include= line add the following

    plugins/Geolocate.js
    
  4. Now the Geolocate plugin will be available in the MapStore build and can be instantiated in the config file with

    {
        "ptype":"gxp_geolocate",
        "enableTracking" : false,
        "layerName": "Position",
        "bind": true,
        "zoom": true,
        "displayInLayerSwitcher": false,
        "geolocationStyles": {
            "pointStyle":{
                    "graphicName": "circle",
                    "strokeColor": "#aaa",
                    "fillColor": "#11f",
                    "strokeWidth": 2,
                    "fillOpacity": 0.7,
                    "strokeOpacity": 0.6,
                    "pointRadius": 5
            },"auraStyle":{
                    "fillOpacity": 0.3,
                    "fillColor": "#55b",
                    "strokeColor": "#00f",
                    "strokeOpacity": 0.6
            },
        "geolocationOptions": {
                "enableHighAccuracy": true,
                "maximumAge": 0,
                "timeout": 7000
            }
        },
        "actionTarget":{
            "target":"paneltbar",
            "index": 22
        }
    }
    

    Please refer to the Manage Viewer Configuration section for more information