Skip to content
This repository has been archived by the owner on May 6, 2021. It is now read-only.

mapStoreConfig File

Tobia edited this page Jun 30, 2014 · 45 revisions

Configuration Options

  • geoStoreBase: Geostore URL (if empty http://<server>:<port>/geostore/rest/ is used)

  • proxy:proxy URL

  • defaultLanguage: default language code,

  • gsSources: Sources for getCapabilities: example:

      {
    "mapquest": {
    	"ptype": "gxp_mapquestsource"
    }, 
    "osm": { 
    	"ptype": "gxp_osmsource"
    },
    "google": {
    	"ptype": "gxp_googlesource" 
    },
    "bing": {
    	"ptype": "gxp_bingsource" 
    }, 
    "ol": { 
    	"ptype": "gxp_olsource" 
    }
           }
    

    Below a possible use case example:

    "geosolutions": {
    	"ptype": "gxp_wmssource",
    	"url": "http://localhost:8080/geoserver/ows",
    	"title": "GeoSolutions GeoServer",
    	"authParam": "authkey",
    	"version":"1.1.1",
        "layersCachedExtent": [
    		-20037508.34,-20037508.34,
    		20037508.34,20037508.34
    	],
    	"layerBaseParams":{
    		"FORMAT":"image/png8",
    		"TILED":true
    	}
    }
    
    • ptype: the type of the tool
    • url: the URL of the WMS source
    • title: the name of the WMS source visible in other MapStore's tools (if missing the one existing in WMS Capabilities is used)
    • authParam: the Authentication param (setted on GeoServer, i.e. 'authkey') in order to reflect
      authorizations settings on MapStore's map.
    • version: the version to use for the WMS
    • layersCachedExtent: during the GeoServer/GeoWebCache integration this property is used to align the extent used from MapStore with the defined Gridset in GWC(GeoServer WMS capabilities returns in this case only 4326 as SRS for the bbox of the layers, and the coordinate conversion to the map's SRS performed by proj4js is not aligned with the GWC Gridset, so tiles are not created properly).
    • layerBaseParams: the base params to use for each WMS GetMap request.
  • proj4jsDefs: additional proj4js Definitions example:

      {"EPSG:3003":"+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=1500000 +y_0=0 +ellps=intl +units=m +no_defs"}
    
  • map Map Configuration. Example:

    { "projection": "EPSG:900913", "units": "m", "center": [1250000.000000, 5370000.000000], "zoom":5, "maxExtent": [ -20037508.34, -20037508.34, 20037508.34, 20037508.34 ], "layers": [{ "source": "mapquest", "title": "MapQuest OpenStreetMap", "name": "osm", "group": "background" }] }

  • transitionEffect & zoomMethod: These properties values can be customized using a proper configuration object inside the map configuration. For example in order to disable these you can use the configuration below:

      "animatedZooming": {
      	"zoomMethod": null,
      	"transitionEffect": null
      }
    
  • tools:Optional Array of tools configurations. If present, overrides the configuration in Composer.js.

  • viewerTools: Optional Array of tools that overrides the default tools for the Viewer. If you want to customize the viewer with other custom layer selector, you can remove the LayerChooser from the toolbar adding disableLayerChooser:true to this configuration. NOTE:This options is not tested yet with configuration saving on GeoStore.

  • removeTools: Optional Array of tools to be removed from standard configuration. It can be a list of ids (of the standard plugins) or a list of objects with name - value matching properties (for example to remove all plugins of a certain ptype). Each standard plugin has an id that looks like <plugintype>_plugin. You can also remove standard separators, whose id is the combination of following plugin's id with a separator suffix (e.g. zoombox_separator). Some examples:

                     "removeTools":["googleearth_plugin", "googleearth_separator"]
    

    or

                     "removeTools":[{
                         "ptype": "gxp_googleearth"
                     }]
    
  • customTools: Optional Array of tools configurations. MapStore provides a default list of plugin used for the viewer. Using customTools you can provide an additional plugin configuration list to the default one.By default you cannot have two configuration of the same plugin. So that defined in customTools override the default one. In order to override this behavior MapStore allows you to specify a forceMultiple (setted to true) for the additional plugin configuration. In this way you can have multiple plugin’s instances. Below an example, to set a custom extent for the Zoom To Max Extent plugin:

      	"customTools":[
      	{
                  "ptype": "gxp_zoomtoextent",
                  "actionTarget": {"target": "paneltbar", "index": 1},
      	    "extent":[ 1046403.2 , 5200006.1,  1413757.5 ,   5544708.1]
      	},
      	{
                  "ptype": "gxp_zoomtoextent",
                  "forceMultiple":true,
                  "actionTarget": {"target": "paneltbar", "index": 13}
                  
      	}
      	/...
    

This configuration will change the extent of the default plugin (first config) and will add another one,using the forceMultiple attribute, with the default values instead.

  • portalConfig: Optional configuration to override gxp Viewer configuration. See here for more details.

  • customPanels: Optional Array of Ext.Panel configurations. If present allows to introduce additional panels to the viewport.

  • georeferences: Array of regions. If present, overrides the default georeferences_data variable defined in data/georeferences.js.

  • tab : Force to use Tabs visualization for the viewport.

Complete Example:

		{
		"geoStoreBase":"http://localhost:8080/geostore/rest/",
		"proxy":"/http_proxy/proxy/?url=",
		"defaultLanguage": "en",
		"gsSources":{ 

			"mapquest": {
				"ptype": "gxp_mapquestsource"
			}, 
			"osm": { 
				"ptype": "gxp_osmsource"
			},
			"google": {
				"ptype": "gxp_googlesource" 
			},
			"bing": {
				"ptype": "gxp_bingsource" 
			}, 
			"ol": { 
				"ptype": "gxp_olsource" 
			}
		},
		"map": {
			"projection": "EPSG:900913",
			"units": "m",
			"center": [1250000.000000, 5370000.000000],
			"zoom":5,
			"maxExtent": [
				-20037508.34, -20037508.34,
				20037508.34, 20037508.34
			],
			"layers": [
				{
					"source": "bing",
					"title": "Bing Aerial",
					"name": "Aerial",
					"group": "background"
				}, {
					"source": "osm",
					"title": "Open Street Map",
					"name": "mapnik",
					"group": "background"
				},{
					"source": "mapquest",
					"title": "MapQuest OpenStreetMap",
					"name": "osm",
					"group": "background"
				},{
					"source": "google",
					"title": "Google Roadmap",
					"name": "ROADMAP",
					"group": "background"
				},{
					"source": "google",
					"title": "Google Terrain",
					"name": "TERRAIN",
					"group": "background"
				},{
					"source": "google",
					"title": "Google Hybrid",
					"name": "HYBRID",
					"group": "background"
				}
			]
		
		},
		"customTools": [
				{
				ptype: "gxp_googleearth",
				actionTarget: {target: "paneltbar", index: 24}
				}
		]
	}

Examples

In this section we show some useful configuration tricks.

Configure an empty background layer

To add an empty background to the backgrounds list, add the following configuration to the map layers array:

   {
        "source": "ol",
        "group": "background",
        "fixed": true,
        "type": "OpenLayers.Layer",
        "visibility": false,
        "args": [
            "None", {"visibility": false}
        ]
   }

Configure a different background color for OL Map

Interact directly with the CSS settings and then use a specific Theme for the OL Map inside the MapStore configuration, for example:

  1. Define a new file named 'bg.css' in 'app\static\theme\app' which contains simply:

    div.olMap{ background-color: #000000; }

  2. Then refer this inside the MapStore configuration:

     "map": {
     		"theme": "theme/app/bg.css",
    

Add Custom panels directly from configuration

The customPanels attribute is an Array that can contain many Ext.Component configuration object that will be placed inside MapStore.

They can be used to wrap plugins, contain custom html or also other custom panels. One exemple of the use of custom panels is the markerEditor.

http://localhost:8081/viewer?config=markerEditor

The customPanelSample configuration is an ad hoc exemple to help you to use this useful configuration option. It shows nested panel definition, plugin placement, custom html, and also an IFrame.

http://localhost:8081/?config=customPanelSample

NOTE: if you want to place some custom panels inside other custom panel (e.g. some panels inside a tab), you have to place the container before the other panels in the array.

Custom panels can have the target attribute (String) . If present, the panel will be placed inside the container with this string as id (for exemple, the tab panel that contains the layer tree and the legend has west as id). If target is not present the panel will be placed inside the portalPanel.

This is an extract from customPanelSample.js

"customPanels":[
        {
            "xtype":"panel",
            "id":"additionalTab", 
	    "target": "west",
	    "title": "my New Tab",
            "layout":"accordion"
        },{
		"target":"additionalTab",
		"html":"This is a custom panel. Both this and 'my New Tab' are custom panels.",
		"title": "Panel 1"
	},{
		"target":"additionalTab",
		"html":"insert your plugin here",
		"title": "Panel 2"
	},{
            "xtype":"tabpanel",
            "id":"east", 
            "region": "east",
            "width": 570,
            "minWidth":550,
		"activeTab": 0,
		"border":false,
            "collapseMode": "mini" ,
	    "items":{
		"xtype":"panel",
		"id":"editor",
		"title":"editor",
		"layout":"fit",
		"target":"east"
			
	    }
        },{
	    "xtype":"panel",
            "id":"south", 
	    "region":"south",
	    "html":"another custom panel....",
	    "height":100
	},{
	    "target":"east",
	    "html":"<iframe style='width:100%;height:100%' src='http://mapstore.geo-solutions.it' ><iframe/>",
	    "layout":"fit",
            "itemId":"startTab",
	    "title": "MapStore WebSite"
	}
    ],
//....
"customTools":[
//...
{
	"ptype": "gxp_marker_editor",
	"outputTarget":"editor",
        "toggleGroup":"toolGroup"
}]

###Use a TabPanel to contains MetadataExplorer and FeatureGrid //... "customPanels":[ { "xtype": "tabpanel", "title": "Data Viewer", "border": false, "id": "south", "region": "south", "split":true, "height": 330, "collapsed": true, "collapsible": true, ** "activeItem": 0,** "header": true, "hideMode": "offsets", "items": [ { "xtype": "container", "title": "Feature Grid", "border": false, "layout": "fit", "id": "featuregrid" },{ "xtype": "container", "title": "Metadata Explorer", "iconCls": "csw-viewer",
"border": false, "layout": "fit", "id": "metadata" } ] }, //...

Enable 45 degrees view with Google Aerial/Hybrid backgrounds

In MapStore google 45 degrees view is disabled by default. To enable it, you can set the enableTilt flag to true in the google source:

"google": {
   "ptype": "gxp_googlesource",
   "enableTilt":false 
},

Enable display of localized Google Map layers and related onmap messages (from 1.5)

In MapStore google layers are displayed by default using the browser locale. To use the current MapStore locale instead, using the following configuration snippet:

"google": {
   "ptype": "gxp_googlesource",
   "localized":true
},
Clone this wiki locally