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

WMS Get Feature Info Menu

Lorenzo Pini edited this page Apr 13, 2015 · 11 revisions

WMS Get Feature Info Menu is an alterantive to the WMSGetFeatureInfo tool in mapstore. This tool extends the functionalities of the other tools allowing to choose a new option to query the selected layer on mouse hover.

The information can be displayed in a Popup (the default configuration), or in a Panel set by the user.

Enabling this tool and selecting a layer in the layer tree, the user will be able to inspect the informations about the selected layer moving the mouse over the map.

You can easly replace the old tool with this new one changing the ptype gxp_wmsgetfeatureinfo to gxp_wmsgetfeatureinfo_menu in the Composer.js and/or Viewer.js under mapcomposer/app/static/script/GeoExplorer/ directory.

The configuration is the same of WMSGetFeatureInfo:

  • ptype:"gxp_wmsgetfeatureinfo_menu"
  • toggleGroup: String - the name of the button group mutually exclusive
  • closePrevious: boolean - if true just one popup at time will be shown (only for click). default: true
  • useTabPanel: boolean - get the feature info of the layer in tabs insead of accordion panels (only for click),default: false
  • infoPanelId: string - this is the identifier of the panel where you want to display the features info. If this property is omitted, or if it is left blank, the details are displayed in a pop-up, which is the default setting
  • disableAfterClick: boolean - if true this property allows you to disable control after every click ,default: false
  • loadingMask: boolean - show the loading mask while loading get feature info.only for click)
  • format String - Format to show feature info. ('grid' | 'html'). Default it's 'html'.(default:true) note: using the grid format, you will download also the geometry, so don't use this format for big geometries.
  • actionTarget: Object - info about where to place the tool
  • target String - the id of the component (default: paneltbar)
  • index int - the position inside the target component.
  • regex String - A regular expression to evaluate the server response, if matched, the content is displayed
  • infoAction String - click , hover, all (default to all), select wich tools will be available in the menu
  • paginate Boolean - true or false (default to false) Enable the pagination inside the WMSGetFeatureInfo window
  • outputGridConfig Object - Allow the customization of the grid format, adding custom rows with a template, changing display name of the properties, hide some other properties.

Example (information displayed in a Popup):


    {
        "ptype":"gxp_wmsgetfeatureinfo_menu",
        "toggleGroup":"toolGroup",
        "closePrevious": true,
        "useTabPanel": false,
        "infoPanelId": "",
        "disableAfterClick": false,
        "loadingMask": true,
        "actionTarget":{
            "target":"paneltbar",
            "index":20
        },
        "regex":"<table[^>]*>([\\s\\S]*)<\\/table>"
    }

Example (information displayed in a Panel):

"customPanels":[
    {
        "xtype": "panel",
        "iconCls": "getfeatureinfo-icon",
        "border": false,
        "id": "infoPanel",
        "region": "east",
        "layout": "fit",
        "split":true,
        "width": 400,
        "collapsed": true,
        "collapsible": true,
        "header": true
    }
]

"customTools":[
    {
        "ptype":"gxp_wmsgetfeatureinfo_menu",
        "toggleGroup":"toolGroup",
        "closePrevious": true,
        "useTabPanel": false,
        "infoPanelId": "infoPanel",
        "disableAfterClick": false,
        "loadingMask": true,
        "actionTarget":{
            "target":"paneltbar",
            "index":20
        }
    }
]

Customize grid format to display custom fields, hide and display them

It's possible to configure WMSGetFeatureInfoMenu with outputGridConfig param. Example:

"outputGridConfig":{
    "workspace:layer":{ //layer name
      "ignoreFields":["track_dir","orbit"], 
      "propertyNames":{"location_":"location"}, //header
      "extraFields":{"link":"<a href='http://www.geo-solutions.it/'>{location_}</a>"} 
    }
}

extraFields has a name and a template, template will recive feature.attributes as data.

Clone this wiki locally