[Users] Migrating MapFish LayerTree to GeoExt LayerTree

Matt Priour mpriour at kestrelcomputer.com
Wed Jul 28 23:05:24 CEST 2010


Mark,

The lack of response is likely do to the fact that the customization 
requirements you have are much more difficult to fill with the GeoExt 
layertree than the Mapfish version.

Using the baseParams & filter parameter of the LayerTreeLoader configuration 
object will provide you with most of the functionality that you need.

If that fails you can just create the GeoExt LayerNodes directly which will 
accept and respect all the options that normal nodes do in addition to a 
required 'layer' parameter.

It takes some time & effort to understand the options and apply them 
correctly. You very well may have to follow along in the code to really get 
what you want produced.
I just undertook a similar change to an application and it took me about 20 
hours to really get it doing what I wanted correctly.

GeoExt has made the normal use cases dead simple and almost effortless to 
use. However for highly customized node by node configurations, one must 
really understand the different GeoExt node types, what options they expect 
& how they behave.

Good Luck, it is knowledge worth having and I don't know if the highly 
customized use cases could be made easier without a custom node type or 
making the simple cases more difficult.

Matt Priour

--------------------------------------------------
From: "Mark Small" <m.small at ed.ac.uk>
Sent: Wednesday, July 28, 2010 11:13 AM
To: <users at geoext.org>
Subject: [Users] Migrating MapFish LayerTree to GeoExt LayerTree

> 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.
>
> From the examples in GeoExt I can't see where we can specify a different 
> icon
> for each leaf node of the tree or tie the node to a sub-layer of the map.
>
> Any ideas/examples would be appreciated, thank you.
>
>
>
> MARK
>
> CIAO
>
> -- 
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
> 


More information about the Users mailing list