[Users] Migrating MapFish LayerTree to GeoExt LayerTree
Mark Small
m.small at ed.ac.uk
Wed Jul 28 18:13:47 CEST 2010
Hi there,
Sorry for the re-post but I am hoping this may generate a response as I am
struggling at the moment.
We have an app with a map with multiple layers, containing multiple sub-
layers. With MapFish we generate some json where the layerNames attribute is
set to the layer:sub-layer e.g.
return [{
text: 'Clear/Select all Layers',
leaf: true,
layerNames: ['Marine'],
iconCls: 'no-icon',
checked: true
}, {
text: 'Bathymetry & Elevation',
leaf: false,
layerNames: ['Marine:57000'],
iconCls: 'no-icon',
expanded: false,
checked: true,
children: [{
text: 'Bathymetry',
leaf: true,
layerNames: ['Marine:56500'],
iconCls: 'no-icon',
expanded: false,
checked: true,
children: [{
text: 'Depth Area',
leaf: false,
layerNames: ['Marine:56000'],
iconCls: 'no-icon',
checked: true,
children: [{
text: 'Depth Area Text',
leaf: true,
layerNames: ['Marine:55701'],
icon: serverUrl +
'legend_icons/bgs625k/2010_625k_bed_APP_46165.png',
checked: true
}, {
text: 'Undefined Depth',
icon: serverUrl +
'legend_icons/bgs625k/2010_625k_bed_APP_46165.png',
leaf: true
}, {
text: 'Intertidal',
icon: serverUrl +
'legend_icons/bgs625k/2010_625k_bed_APP_46165.png',
leaf: true
....
}];
When constructing the map initially we supply it with a number of parameters
e.g.
var params = {
transparent: true,
layers: [ 57000, 56500, 56000, 55701 ],
format: 'image/png',
srs: 'EPSG:27700'
};
var layer = new OpenLayers.Layer.WMS("Marine")", urls, params, options);
The numbers in the layers attribute correspond to layerNames in the tree model
prefixed with the name of the layer e.g. Marine.
When the checkbox is clicked on the LayerTree, the map contacts the WMS(s) and
gets all the layers with the checkboxes ticked, displaying only the layers the
user wants.
I have migrated most of our code away from MapFish, this being the last bit,
but like I said I'm struggling to see how to do this with GeoExt. We must get
the legend from the server as it gets the data from a database and generates
the json string.
More information about the Users
mailing list