Table Of Contents

Previous topic

gxp.plugins.GoogleGeocoder

Next topic

gxp.plugins.LayerManager

gxp.plugins.GoogleSource

Extends
ptype
gxp_googlesource
class gxp.plugins.GoolgeSource(config)

Plugin for using Google layers with gxp.Viewer instances. The plugin uses the GMaps v3 API and also takes care of loading the required Google resources.

Available layer names for this source are “ROADMAP”, “SATELLITE”, “HYBRID” and “TERRAIN”

Example Use

The configuration in the sources property of the gxp.Viewer is straightforward:

"google": {
    ptype: "gxp_google"
}

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: "google",
    name: "TERRAIN"
}

Config Options

Configuration properties in addition to those listed for Ext.util.Observable.

hybridAbstract

String Description of the HYBRID layer (i18n).

otherParams

String Additional parameters to be sent to Google, default is “sensor=false”

roadmapAbstract

String Description of the ROADMAP layer (i18n).

satelliteAbstract

String Description of the SATELLITE layer (i18n).

terrainAbstract

String Description of the TERRAIN layer (i18n).

title

String A descriptive title for this layer source (i18n).

Public Properties

Public properties in addition to those listed for Ext.util.Observable.

GoogleSource.hidden

Boolean Set to true if you don’t want this LayerSource to show up in the AddLayers dialog. Defaults to false.

GoogleSource.lazy

Boolean. true when the source is ready, but its store hasn’t been loaded yet (i.e. lazy source). Read-only.

GoogleSource.store

GeoExt.data.LayerStore containing records with “ROADMAP”, “SATELLITE”, “HYBRID” and “TERRAIN” name fields.

GoogleSource.title

String A descriptive title for this layer source.

Public Methods

Public methods in addition to those listed for Ext.util.Observable.

GoogleSource.createLayerRecord()
Parameters:configObject The application config for this layer.
Returns:GeoExt.data.LayerRecord

Create a layer record given the config.

GoogleSource.createStore()

Creates a store of layer records. Fires “ready” when store is loaded.

GoogleSource.getConfigForRecord()
Parameters:recordGeoExt.data.LayerRecord
Returns:Object

Create a config object that can be used to recreate the given record.

GoogleSource.getProjection()
Parameters:layerRecordGeoExt.data.LayerRecord a record from this source’s store
Returns:OpenLayers.Projection A suitable projection for the layerRecord. 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.

GoogleSource.getState()
Returns:Object

Gets the configured source state.

GoogleSource.gxp.plugins.GoogleSource.loader.onLoad()
Parameters:optionsObject

Options:

  • callback - Function Called when script loads.

  • errback - Function Called if loading fails.

  • timeout - Number Time to wait before deciding that loading failed

    (in milliseconds).

  • scope - Object The this object for callbacks.

GoogleSource.init()
Parameters:targetObject The object initializing this plugin.

Calls createStore() with a callback that fires the ‘ready’ event.

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.