You might need to report on attributes of a table that hasn't already been When you have a layer that you want to be able to graphically select from and report on its attributes, it needs to be set up as an Active Layer. This article assumes that you already have some Active Layers configured in Weave.
** IN PROGRESS **
Step-by-step guide
...
- If the layer you want to add as a new Active Layer is in the Table of Contents (TOC)/Map Layers, make a note of the name shown in the TOC.
- Generally, an Active Layer is related to a Map Layer from the TOC but it doesn't have to be as the case. In the extreme, you can have only a raster base map in your TOC but you will still be able to do a graphical selection and have the selection appear over the raster map. In this case it will appear as though features on the raster map have been selected, while in fact it is the vector layer that is used in the graphical selection.
- Open your
toc.xml
file for editing. Search for the name of the Map Layer you identified above (it will appear as thelabel
tag). Note the value of thelayer
parameter. While you're in the toc.xml, add a XML Attribute called
entity
.
In the example below theentity
attribute is added to thecounciltrees
layer and is set to to add is called tocouncil
and is specified as:trees
Code Block language xml theme Eclipse <entry id='l_mapengine.main_counciltrees' layer='counciltrees' label='Council Trees' checked='false' entity='counciltrees'/>
Adding this
entity
attribute sets the relationship between the Active Layer and the Map Layer that is drawn from the TOC and means the Map Layer in the TOC will be highlighted when the corresponding layer is selected from the Active Layer list. To have the Set Active option available on the TOC Context Menu (right mouse click), ensure you have theweave.toc.selectLayer
item enabled in theclient_main.xml
file.Open your
entity.xml
file for editing. Add an XML Element for this entity.Code Block language xml theme Eclipse <entity:entity id='counciltrees'> <label>Council Trees</label> </entity:entity>
The value of the (XML Attribute)id
for the entity (shown in the image above) should match the (XML Attribute) entity from thetoc.xml
file (shown in Step 3). In our example it's "counciltrees".
Thelabel
in theentity.xml
doesn’t have to match thelabel
in thetoc.xml
file but it’s recommended to keep them the same to avoid confusion for the user, unless there’s a good reason why these should be different.- If you refresh your browser you'll now see the Active Layer has been added to the Active Layer drop-down list. However it will have a different icon to the other Active Layers in the list as it hasn't been linked to a spatial database.
Stay in the
entity.xml
file. You now need to specify where the spatial data for the selection will be coming from by adding anothermapping
XML Entity that links the Active Layer to its relevant Spatial Engine. Add this to themapper
element that is reading from the required Spatial Engine,and include the table name, key field, etc. as shown below. You can set a filter tag so that only features that meet certain criteria will be considered for selection.Code Block language xml theme Eclipse <mapping> <entity>counciltrees</entity> <spatialengine>postgis</spatialengine> <table>counciltrees</table> <key>ogc_fid</key> <dynamic>true</dynamic> </mapping>
If there are no Active Layers from the Spatial Engine you need to access, then you'll need to add a new tag for that Spatial Engine. For simplicity, give this mapper an id ofmapper.<spatialengine_id> as shown below.
Code Block language xml theme Eclipse <mapper:mapper id="mapper.postgis"> <mapping> <entity>counciltrees</entity> <spatialengine>postgis</spatialengine> <table>counciltrees</table> <key>ogc_fid</key> <dynamic>true</dynamic> </mapping> </mapper:mapper>
If you refresh your browser you'll now see that the icon for that Active Layer has changed to a layer-like icon.This icon indicates that the Active Layer is now a spatial layer.- vv
- You may need to refresh your browser to see this attribute appear in your Data Grid window.
** Section below is copied from Installation Notes ... need to add to How-to above:
Restart Weave to see the effect of the changes that have been made so far.
- If you now run a spatial selection, the selected features will be selected but you won’t see them highlighted on highlighted in the Map Window. You can tell features have been selected as this The number of features selected will be reported in the bottom right of the Weave window, in the Status Bar, as “Selection Size”.This selection will be made visible in the map by adding an entry in the mapengine.xml file for that selection engine. And add the Selection Name Space to the top config section of the mapengine.xml file.
Add the selection map engine to the client_main.xml, under the <mapEngine id="mapengine.main"> tag. Make it <mapEngine id="mapengine.selection">.
Add a Selection Map Engine to your toc.xml (call it mapengine.selection). This can be copied from the Weave documentation wiki under the Configuration Reference > Map Engine > Map Engine Selection section.
There is the option of adding selections to the Table of Contents so the Active Layer’s selection is visible or selections on all Map Layers are visible, and allowing these to be turned on/off like other Map Layers. Or you can choose not to have this as a layer that can be turned on/off by adding the selection map engine but making the entry not visible in the TOC.
Restart Weave and run a spatial selection; the selected features will be highlighted in the Map Window.
However, at this stage, there is no relationship between the Active Layer and the Map Layer that is drawn from the TOC. This is done by adding an entity tag to the toc.xml file on the corresponding entry id. Now the Map Layer in the TOC will be highlighted when the corresponding layer is selected from the Active Layer list.
To have the Set Active - option available on the TOC Context Menu (right mouse click), ensure you have the weave.toc.selectLayer item enabled in the client_main.xml file.
ccYou may need to refresh your browser to see this attribute appear in your Data Grid window. - Done.
Info |
---|
Also refer to the following sections of the Weave System Administrator Guides:
|
...