Skip to content

WFS Search

offtherailz edited this page Oct 1, 2012 · 3 revisions

Introduction

This plugin allow a textual search using a WFS service.

Configuration

The plugin can be configured using the outputConfig field to inject the configuration of the WFSSearchComboBox widget used by this plugin.

  • updateField: the field used as geometry
  • zoom: the zoom level to use if the geometry has not a computable bbox (e.g. points) when you select a feature.
  • outputConfig: the widget configuration
    • url: the URL of the WFS service
    • typeName: the layer to query
    • recordModel: the model of the record. Maps the getFeature entries with localFields.
    • sortBy: field to use to sort results (a sorting field is required to allow pagination
    • queriableAttributes: attributes to use in the cql filter of the request to perform textual query
    • displayField: field to show if no template is specified
    • pageSize: page size of the request (default 10)
    • tpl: Extjs XTemplate to have show results (use fields specified in recordModel configuration)
    • width: dimension of the widget.

A sample configuration below:

   {
	  "ptype":"gxp_wfssearchbox",
	  "outputConfig":{
		 "url":"http://office.geo-solutions.it/acque/geoserver/SW/ows?",
		 "typeName":"SW:SF",
		 "recordModel":[
			{
			   "name":"id",
			   "mapping":"id"
			},
			{
			   "name":"geometry",
			   "mapping":"geometry"
			},
			{
			   "name":"codice_ato",
			   "mapping":"properties.codice_ato"
			},
			{
			   "name":"denominazi",
			   "mapping":"properties.denominazi"
			}
		 ],
		 "sortBy":"codice_ato",
		 "queriableAttributes":[
			"codice_ato",
			"denominazi"
		 ],
		 "displayField":"codice_ato",
		 "pageSize":10,
		 "width":250,
		 "tpl":"<tpl for=\".\"><div class=\"search-item\"><h3>{codice_ato}</span></h3>{denominazi}</div></tpl>"
	  },
	  "updateField":"geometry",
	  "zoom":18,
	  "outputTarget":"paneltbar",
	  "index":30
   },

the configuration above will perform a WFS GetFeature request with the parameters below :

startindex:0
maxfeatures:10
service:WFS
version:1.1.0
request:GetFeature
typeName:SW:SF
outputFormat:json
sortBy:codice_ato
cql_filter:(codice_ato LIKE '%b%') OR (denominazi LIKE '%b%')
srsName:EPSG:900913

Clone this wiki locally