A Panel to hold a spatial search either by drawing geometries and/or selecting features from another layer. Also can be initialized with features found through external search (see MultiSearchCenterPanel). Combines: https://code.google.com/p/geoext-viewer/issues/detail?id=177 and https://code.google.com/p/geoext-viewer/issues/detail?id=178 (like ArcGIS Search by Location).
The SpatialSearchPanel supports:
Search by Feature Selection: select from one or more source layers, add last result (geometries) to current selection, replace selection with last result (geoms), clear selection, use selection from drawn sketch (sketchOnly option in search by draw).
- Search by Draw:
- draw features on map, option: sketchOnly: do not search but add to selection layer (switch to select by feature to use).
See examples. Sample code showing how to configure a Heron SpatialSearchPanel.
Heron.examples.searchPanelConfig = {
xtype: 'hr_searchcenterpanel',
hropts: {
searchPanel: {
xtype: 'hr_spatialsearchpanel',
id: 'hr-spatialsearchpanel',
header: false,
border: false,
style: {
fontFamily: 'Verdana, Arial, Helvetica, sans-serif',
fontSize: '12px'
},
searchByFeature: {
active: true
},
searchByDraw: {
active: false,
sketchOnly: false,
cumulative: false
}
},
resultPanel: {
xtype: 'hr_featuregridpanel',
id: 'hr-featuregridpanel',
header: false,
border: false,
autoConfig: true,
hropts: {
zoomOnRowDoubleClick: true,
zoomOnFeatureSelect: false,
zoomLevelPointSelect: 8,
zoomToDataExtent: false
}
}
}
};
nd then enable the SpatialSearchPanel as a MapPanel toolbar item (type: ‘searchcenter’, icon: binoculars).
Heron.options.map.toolbar = [
{type: "featureinfo", options: {max_features: 20}},
{type: "-"} ,
{type: "pan"},
{type: "zoomin"},
{type: "zoomout"},
{type: "zoomvisible"},
{type: "-"} ,
{type: "zoomprevious"},
{type: "zoomnext"},
{type: "-"},
{
type: "searchcenter",
// Options for SearchPanel window
options: {
show: true,
searchWindow: {
title: __('Spatial Search'),
x: 100,
y: undefined,
width: 360,
height: 400,
items: [
Heron.examples.searchPanelConfig
]
}
}
}
Configuration properties in addition to those listed for Ext.Panel.
String Default description in status area.
Array Features from last external Search. Default null
String Name of last Search (UNUSED). Default null
Function Filter for OpenLayer getLayersBy(), to filter out WFS-enabled Layers from Layer array.
Default: only Layers that have metadata.wfs (see OpenLayers Layer spec and examples) set.
String How should the layer names be sorted in the selector, ‘ASC’, ‘DESC’ or null (as Map order)? default value is ‘ASC’ (Alphabetically Ascending).
Integer Max features to use for Search selection. Default 24
String Name, e.g. for multiple searches combo.
Object Search by draw options. Default reddish
Object Search by selected features options. Default reddish
Object OpenLayers Style config to use for features Selection Layer. Default reddish
Public methods in addition to those listed for Ext.Panel.
Called just before Panel is destroyed.
Called when feature drawn selected.
Called when Layer selected.
Called when Panel has been rendered.
Called when parent Panel is hidden in Container.
Called when parent Panel is shown in Container.
Function to call when search is complete. Default is to show “Search completed” with feature count on progress label.
Called when remote search (WFS) query has started.
Issue spatial search via WFS.
Issue spatial search via WFS.