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

WFSGrid Plugin

Riccardo Mari edited this page Feb 19, 2014 · 6 revisions

Introduction

This plugin allows you to display WFS features in a custom grid inside MapComposer. You can also add some action columns to the grid, that allow you to visualize and zoom to features.

Needed Files

Include in buildjs these files:

  • gxp/src/script/plugins/WFSGrid.js

Configurations properties

  • "ptype": "gxp_wfsgrid",
  • "wfsURL": string, URL of the WFS service,
  • "outpuTarget": string, plugin target (plugin general configuration),
  • "srsName" : string, srs in the form, for example "EPSG:4326",
  • "paging" : boolean, if set to "true" enable the pagination of the features in the grid, default to "true",
  • "pageSize" : int, number of features to visualize for page, default to 10,
  • "title" : string, optional title of the grid,
  • "fields" : array object, Explicitly configure grid store fields to use (columns array of the Ext.Grid),
  • "columns" : array object, Explicitly configure grid columns to use (columns array of the Ext.Grid),
  • "actionColumns" : array object, Explicitly configure grid actioncolumn.

Possible Action Column Type are:

checkDisplay: allow to display the checked features in a map

  • "type": "checkDisplay",
  • "layerName": string, highlight layer name,
  • "sourceSRS": string, source srs of wfs layer

zoom: allow to zoom to the feature in a map

  • "type": "zoom",
  • "sourceSRS": string, source srs of wfs layer

Important!!!

View this issue Check WFS Grid zoom #323 to manage layers served by geoserver with SRS EPSG:4326

Configuration Example

    ...
    "customPanels":[
        {
            "xtype": "panel",
            "title": "WFSGrid Panel",
            "border": false,
            "id": "gridcontainer",
            "region": "south",
            "layout": "fit",
            "split":true,
            "height": 330,
            "collapsed": true,
            "collapsible": true,
            "header": true
        }
    ]
    ...
    "customTools":[
    ...
        {
            "ptype": "gxp_wfsgrid",
            "wfsURL": "http://localhost:8080/geoserver/wfs",
            "featureType": "states",
            "outputTarget": "gridcontainer",
            "srsName": "EPSG:4326",
            "paging": true,
            "pageSize": 10,
            "fields": [
                {
                    "name": "state_name",
                    "mapping": "STATE_NAME"
                },
                {
                    "name": "state_fips",      
                    "mapping": "STATE_FIPS"
                },
                {
                    "name": "sub_region",      
                    "mapping": "SUB_REGION"
                }
            ],
            "columns": [
                {
                    "header": "State name",
                    "dataIndex": "state_name"
                },
                {
                    "header": "State fips",
                    "dataIndex": "state_fips"
                },
                {
                    "header": "Sub region",
                    "dataIndex": "sub_region"
                }
            ],
            "actionColumns": [{
                "type": "checkDisplay",
                "layerName": "Highlight Layer",
                "sourceSRS": "EPSG:4326"
            },
            {
                "type": "zoom",
                "sourceSRS": "EPSG:4326"
            }]            
        }
    ...
    ]
Clone this wiki locally