GeoPrisma logo

MapFishLayerTree

Creates a MapFish LayerTree widget using the model defined in the options.

XML Sample

Sample configuration

<mapfishlayertree>
  <name>W_MyMapFishLayerTree</name>
  <options>
    <nodes>
      <node>
        <textkey>
          <domain>afghanistan</domain>
          <key>i18n_all_layer</key>
        </textkey>
        <icon>../../lib/externals/openlayers-trunk/img/zoom-world-mini.png</icon>
        <checked>undefined</checked>
        <nodes>
          <node>
            <textkey>
              <domain>afghanistan</domain>
                <key>i18n_overlay_layer</key>
              </textkey>
              <icon>../../lib/externals/openlayers-trunk/img/zoom-world-mini.png</icon>
              <checked>undefined</checked>
              <nodes>
                <node>
                  <servicetype>featureserver</servicetype>
                  <resourcename>123-ResourceParcel</resourcename>
                  <textkey>tomate</textkey>
                  <checked>false</checked>
                </node>
                <node>
                  <servicetype>wms</servicetype>
                  <resourcename>ResourceAFParcel</resourcename>
                  <textkey>
                    <domain>afghanistan</domain>
                    <key>i18n_layer_parcel_af</key>
                  </textkey>
                  <checked>false</checked>
                </node>
              </nodes>
            </node>
          </nodes>
        </node>
     </nodes>
   </options>
 </mapfishlayertree>

Sample configuration with grouped resources that have the same wms service. When nodes with servicetype “wms” defined on the same level share the same OpenLayers.Layer.WMS object, they dynamically update the layer “param” property when is selected/deselected.

<mapfishlayertree>
    <name>W_MyMapFishLayerTree</name>
    <options>
        <nodes>
          <node>
            <textkey>TileCache</textkey>
            <checked>undefined</checked>
            <nodes>
              <node>
                <servicetype>tilecache</servicetype>
                <resourcename>R_GMAP_PROV</resourcename>
                <textkey>Province Boundaries</textkey>
                <checked>true</checked>
              </node>
            </nodes>
          </node>

          <node>
            <textkey>WMS</textkey>
            <checked>true</checked>
            <nodes>
              <node>
                <servicetype>wms</servicetype>
                <resourcename>R_GMAP_PARK</resourcename>
                <textkey>Parks</textkey>
                <checked>false</checked>
              </node>
              <node>
                <servicetype>wms</servicetype>
                <resourcename>R_GMAP_FEDL</resourcename>
                <textkey>Federal Limits</textkey>
                <checked>true</checked>
              </node>
              <node>
                <servicetype>wms</servicetype>
                <resourcename>R_GMAP_RAIL</resourcename>
                <textkey>Railroads</textkey>
                <checked>false</checked>
              </node>
              <node>
                <servicetype>wms</servicetype>
                <resourcename>R_GMAP_ROAD</resourcename>
                <textkey>Roads</textkey>
                <checked>false</checked>
              </node>
              <node>
                <servicetype>wms</servicetype>
                <resourcename>R_GMAP_POPP</resourcename>
                <textkey>Cities</textkey>
                <checked>true</checked>
              </node>
            </nodes>
          </node>

          <node>
            <textkey>Vector</textkey>
            <checked>undefined</checked>
            <nodes>
              <node>
                <servicetype>featureserver</servicetype>
                <resourcename>R_GMAP_ROAD</resourcename>
                <textkey>Roads</textkey>
                <checked>true</checked>
                <maxScale>1000005</maxScale>
                <minScale>500000</minScale>
              </node>
              <node>
                <servicetype>featureserver</servicetype>
                <resourcename>R_GMAP_POPP</resourcename>
                <textkey>Cities</textkey>
                <checked>true</checked>
                <maxScale>1000005</maxScale>
                <minScale>500000</minScale>
              </node>
            </nodes>
          </node>

        </nodes>
    </options>
</mapfishlayertree>

drawWidget Sample

The widget must be drawn with the drawWidget function. See drawWidget / drawWidgets.

Can be drawn in a Ext.Panel or Ext.Window.

Mandatory Options

nodes:Defines the model for the ExtJS tree that will be built by the MapFish LayerTree widget. It can contains several <node> tags.

Note

The ‘nodes’ option used to be ‘model’ which still works but is deprecated.

nodes/node:Must be defined in a <nodes> tag.

==== <node> options ====

checked:

Define if a checkbox is to appear at this node, values are (case sensitive) :

  • true (checkbox present, checked)
  • false (checkbox present, unchecked, this is the default value)
  • undefined (checkbox not present).
textkey:

Text that will appear for this node in the layer tree.

==== leaf <node> options ====

The following options are valid only if the node is a leaf.

resourcename:name of the resource use in layername
layername:Deprecated, use servicetype instead. Name of the layer in the OpenLayers map object. See the layername option in the map widget. Either layername or servicetype must be set.
servicetype:The service type of the layer to have in this leaf. Either layername or servicetype must be set.

Optional Options

==== <node> options ====

expanded:Boolean. Default value is true. If this node as children, make it expanded by default or not.
nodes:A node can contain child nodes as well. These must be defined in the nodes option and will contain <node> tags (see above). This will define this node as a branch in the layer tree and not a leaf.

Note

The ‘nodes’ option of a ‘node’ tag use to be ‘children’ which still works but is deprecated.

icon:URL to this node icon.
maxScale:Float. Disables the node if the scale of the map gets bigger than this value
minScale:Float. Disables the node if the scale of the map gets smaller than this value

Service Type

N/A

Widget Action

read

Table Of Contents

Previous topic

Map

Next topic

MapFishRecenter

This Page