-
Notifications
You must be signed in to change notification settings - Fork 43
SpatialSelectorQueryForm Plugin
In order to use the SpatialSelectorQueryForm plugin in MapStore you need to be sure that the files below are included in the buildjs.cfg file:
openlayers-ext/lib/OpenLayers/Control/SetBox.jsopenlayers/lib/OpenLayers/Handler/RegularPolygon.jsgxp/src/script/widgets/form/BBOXFieldset.jsgxp/src/script/widgets/FilterBuilder.jsgxp/src/script/plugins/QueryForm.jsgxp/src/script/plugins/spatialselector/SpatialSelectorMethod.jsgxp/src/script/plugins/spatialselector/BBOXSpatialSelectorMethod.jsgxp/src/script/plugins/spatialselector/BufferSpatialSelectorMethod.jsgxp/src/script/plugins/spatialselector/PolygonSpatialSelectorMethod.jsgxp/src/script/plugins/spatialselector/CircleSpatialSelectorMethod.jsgxp/src/script/plugins/spatialselector/GeocoderSpatialSelectorMethod.jsgxp/src/script/plugins/spatialselector/SpatialSelector.jsgxp/src/script/plugins/SpatialSelectorQueryForm.js
NOTE: In the default configuration this is already done.
IMPORTANT!!! The plugin requires the use of WMS version 1.1.1.
##Plugin Description
The Spatial Selector Query Form plugin allows performing queries on feature layers. Using this plugin you can create alphanumeric queries on feature attributes and/or spatial query on a specific region of interest.
You can also perform spatial queries by the available selector methods:
- BBOXSpatialSelectorMethod:
gxp_spatial_bbox_selector - BufferSpatialSelectorMethod:
gxp_spatial_buffer_selector - CircleSpatialSelectorMethod:
gxp_spatial_circle_selector - GeocoderSpatialSelectorMethod:
gxp_spatial_geocoding_selector - PolygonSpatialSelectorMethod:
gxp_spatial_polygon_selector
NOTE: If you haven't any ROI selected, the query will use the current extension of the map.
##Configuration Example
Besides the plugin configuration, the following script import must be uncommented in the composer.html file:
<!-- Externals OpenLayers libraries -->
<script type="text/javascript" src="script/OpenLayersExt.js"></script>
Then you have to specify a valid plugin configuration, such as:
...
"customPanels":[
...
{
"xtype": "panel",
"title": "FeatureGrid",
"border": false,
"id": "south",
"region": "south",
"layout": "fit",
"height": 330,
"collapsed": false,
"collapsible": true,
"header": true
},
{
"xtype": "panel",
"title": "Query Panel",
"border": false,
"id": "east",
"width": 400,
"height": 500,
"region": "east",
"layout": "fit",
"collapsed": false,
"collapsible": true,
"header": true
}
...
],
...
"customTools":[
...
{
"ptype": "gxp_featuremanager",
"id": "featuremanager"
}, {
"ptype": "gxp_featuregrid",
"featureManager": "featuremanager",
"outputConfig": {
"id": "featuregrid",
"title": "Features"
},
"outputTarget": "south",
"showExportCSV": true
}, {
"ptype": "gxp_spatialqueryform",
"featureManager": "featuremanager",
"featureGridContainer": "south",
"outputTarget": "east",
"showSelectionSummary": true,
"actions": null,
"id": "bboxquery",
"outputConfig":{
"outputSRS": "EPSG:900913"
},
"spatialSelectorsConfig":{
"bbox":{
"xtype": "gxp_spatial_bbox_selector"
},
"buffer":{
"xtype": "gxp_spatial_buffer_selector"
},
"circle":{
"xtype": "gxp_spatial_circle_selector",
"zoomToCurrentExtent": true
},
"polygon":{
"xtype": "gxp_spatial_polygon_selector"
}
}
}
...
]
...-
ptype: ptype of the plugin -
featureManager: The id of the :class:gxp.plugins.FeatureManagerto use with this tool -
outputTarget: plugin identifier -
actions: By default, this tool creates a "Query" action to trigger the output of this tool's form. Set to null if you want to include the form permanently in your layout. -
id: plugin identifier
You can see complete configuration examples:
You can add different selection methods to perform the queries. The configuration of this methods have common and specific parameters.
This options are available for all selection methods:
- name: Name to show on the combo box of the spatial selected.
- label:Label to show on the combo box of the spatial selected.
- zoomToCurrentExtent: Flag to zoom the current map to the selected geometry when you select one. Default is false.
- defaultStyle: Style for features drawn
- selectStyle: Style for selected features drawn
- temporaryStyle: Style for features drawn in this state
- showSelectionSummary: Whether we want to show or not the selection summary as a pop-up on the map. Default it's true
- ptype:
gxp_spatial_bbox_selector
This selector draws a rectangle and use it as bounding box for the query.
- ptype:
gxp_spatial_buffer_selector
- spatialFilterOptions: Default CRS limits if not selection has been made. Must be compliant with the map CRS.
- ptype:
gxp_spatial_buffer_selector
With this selector you can select a location in the map (clicking on it or by coordinates) and a radious to perform the query in the buffer generated.
-
bufferOptions: Map with Buffer spatial selector options:
minValue,maxValue,decimalPrecision,distanceUnits`. - geodesic: Use geodesic on the buffer fieldset
- ptype:
gxp_spatial_circle_selector
You can draw a circle for the spatial selection.
No specific configuration.
- ptype:
gxp_spatial_polygon_selector
You can draw a polygon for the spatial selection.
No specific configuration.
This selector show a WFS combobox to search features in the configured layer. If you want to select more than one record, you must add a WPS manager (see example with WPS)
- ptype:
gxp_spatial_geocoding_selector
- labelStyle: Style for the label on selected features
- wfsBaseURL: WFS Base URL
- geocoderTypeName: Type name to perform the query
- geocoderTypeTpl: Tpl for the Geocoder combo items
- geocoderTypeRecordModel: Record model for the geocoder combo
-
geocoderTypeSortBy: If you want to order the WFS query, put here the order. If you won't, put a
nullinside - geocoderTypeQueriableAttributes: Fetaure properties array to perform the query
- geocoderTypeDisplayField: Feature type property to select as name on the grid.
- geocoderTypePageSize: Page size for the WFS search combo
-
wpsUnionProcessID: ID of the WPS Union Process. Default is
JTS:union - wpsManagerID: Id of the WPS Manager to be used for the union. If it's null, or the tool is not found, it will disable the multiple selection
- multipleSelection: Append a grid and allow multiple WFS record selections. It needs a WPS manager configured.