gxp.plugins.GeoNodeCatalogueSource
¶
-
class
gxp.plugins.
GeoNodeCatalogueSource
(config)¶ Plugin for creating WMS layers lazily. The difference with the WMSSource is that the url is configured on the layer not on the source. This means that this source can create WMS layers for any url. This is particularly useful when working against a Catalogue Service, such as GeoNode.
Example Use¶
Configuration in the gxp.Viewer
:
defaultSourceType: "gxp_wmssource",
sources: {
"opengeo": {
url: "http://suite.opengeo.org/geoserver/wms"
}
}
A typical configuration for a layer from this source (in the layers
array of the viewer’s map
config option would look like this:
{
source: "opengeo",
name: "world",
group: "background"
}
n optional ‘getFeatureInfo’ property can also be passed to ustomize the sort order, visibility, & labels for layer attributes.
sample ‘getFeatureInfo’ configuration would look like this:
{
fields: ["twn_name","pop1990"]
propertyNames: {"pop1990": "1990 Population", "twn_name": "Town"}
}
Within the ‘getFeatureInfo’ configuration, the ‘fields’ property determines sort order & visibility (any attributes not included are not displayed) and ‘propertyNames’ specifies the labels for the attributes.
For initial programmatic layer configurations, to leverage lazy loading of
the Capabilities document, it is recommended to configure layers with the
fields listed in requiredProperties
.
Config Options¶
Configuration properties in addition to those listed for Ext.util.Observable.
-
baseParams
Object
Optional additional params to send in the requests.
-
fields
Array
Fields to use for the JsonReader. By default the following fields are provided: title, abstract, bounds and URI. Optionally this can be overridden by applications to provide different or additional mappings.
-
hidden
Boolean
Normally we do not want these sources to show up in the AddLayers dialog for the source combobox. Set to false for a certain source to show up anyway whenever that makes sense, e.g. by using a catalogue source to retrieve all the layers for a capabilities grid.
-
proxyOptions
Object
An optional object to pass to the constructor of the ProtocolProxy. This can be used e.g. to set listeners.
-
requiredProperties
Array(String)
List of config properties that are required for each layer from this source to allow lazy loading, in addition toname
. Default is["title", "bbox"]
. When the source loads layers from a WMS that does not provide layers in all projections,srs
should be included in this list. Fallback values are available fortitle
(the WMS layer name),bbox
(the map’smaxExtent
as array), andsrs
(the map’sprojection
, e.g. “EPSG:4326”).
-
rootProperty
String
Root property in the JSON response. Defaults to ‘results’.
-
title
String
Optional title for this source.
-
url
String
Online resource of the catalogue service.
-
version
String
If specified, the version string will be included in WMS GetCapabilities requests. By default, no version is set.
-
yx
Object
Members in the yx object are used to determine if a CRS URN- corresponds to a CRS with y,x axis order. Member names are CRS URNs and values are boolean.
Public Properties¶
Public properties in addition to those listed for Ext.util.Observable.
Boolean
Set to true if you don’t want this LayerSource to show up in the AddLayers dialog. Defaults to false.
-
GeoNodeCatalogueSource.
lazy
¶ Boolean
. true when the source is ready, but its store hasn’t been loaded yet (i.e. lazy source). Read-only.
-
GeoNodeCatalogueSource.
requiredProperties
¶ Array(String)
List of config properties that are required for a complete layer configuration, in addition toname
.
-
GeoNodeCatalogueSource.
store
¶ GeoExt.data.LayerStore
-
GeoNodeCatalogueSource.
title
¶ String
A descriptive title for this layer source.
Public Methods¶
Public methods in addition to those listed for Ext.util.Observable.
-
GeoNodeCatalogueSource.
createLayerRecord
()¶ Parameters: config – Object
The application config for this layer.Returns: GeoExt.data.LayerRecord
or null when the source is lazy.Create a layer record given the config. Applications should check that the source is not
lazy`
or that theconfig
is complete (i.e. configured with all fields listed inrequiredProperties
before using this method. Otherwise, it is recommended to use the asynchronousgxp.Viewer.createLayerRecord()
method on the target viewer instead, which will load the source’s store to complete the configuration if necessary.
-
GeoNodeCatalogueSource.
createStore
()¶ Create the store that will be used for the GeoNode searches.
-
GeoNodeCatalogueSource.
describeLayer
()¶ Parameters: - rec –
GeoExt.data.LayerRecord
the layer to issue a WMS DescribeLayer request for - callback –
Function
Callback function. Will be called with anExt.data.Record
from aGeoExt.data.DescribeLayerStore
as first argument, or false if the WMS does not support DescribeLayer. - scope –
Object
Optional scope for the callback.
Get a DescribeLayer response from this source’s WMS.
- rec –
-
GeoNodeCatalogueSource.
filter
()¶ Filter the store by querying the catalogue service. :param options:
Object
An object with the following keys:- . list-table::
widths: 20 80 queryString
- the search string
limit
- the maximum number of records to retrieve
filters
- additional filters to include in the query
-
GeoNodeCatalogueSource.
getConfigForRecord
()¶ Parameters: record – GeoExt.data.LayerRecord
Returns: Object
Create a config object that can be used to recreate the given record.
-
GeoNodeCatalogueSource.
getPagingParamNames
()¶ Returns: Object
with keys start and limit.Get the names of the parameters to use for paging.
-
GeoNodeCatalogueSource.
getPagingStart
()¶ Returns: Integer
Where does paging start at?
-
GeoNodeCatalogueSource.
getProjection
()¶ Parameters: layerRecord – GeoExt.data.LayerRecord
a record from this source’s storeReturns: OpenLayers.Projection
A suitable projection for thelayerRecord
. If the layer is available in the map projection, the map projection will be returned. Otherwise an equal projection, or null if none is available.Get the projection that the source will use for the layer created in
createLayerRecord
. If the layer is not available in a projection that fits the map projection, null will be returned.
-
GeoNodeCatalogueSource.
getSchema
()¶ Parameters: - rec –
GeoExt.data.LayerRecord
the WMS layer to issue a WFS DescribeFeatureType request for - callback –
Function
Callback function. Will be called with aGeoExt.data.AttributeStore
containing the schema as first argument, or false if the WMS does not support DescribeLayer or the layer is not associated with a WFS feature type. - scope –
Object
Optional scope for the callback.
Gets the schema for a layer of this source, if the layer is a feature layer.
- rec –
-
GeoNodeCatalogueSource.
getState
()¶ Returns: Object
Gets the configured source state.
-
GeoNodeCatalogueSource.
getWFSProtocol
()¶ Parameters: - record –
GeoExt.data.LayerRecord
- callback –
Function
- scope –
Object
Returns: OpenLayers.Protocol.WFS
Creates a WFS protocol for the given WMS layer record.
- record –
-
GeoNodeCatalogueSource.
init
()¶ Parameters: target – Object
The object initializing this plugin.
Events¶
Events in addition to those listed for Ext.util.Observable.
-
failure
Fires if the layer source fails to load.
-
ready
Fires when the layer source is ready for action.