Customizing the Forest Model

The Woodstock Translator will create a complete XML file however the translator knows nothing about the spatial data we will be trying to describe using these stand dynamics. The XML file provides a link between the aspatial data of the stand dynamics and the spatial block data we generated earlier.

The XML file generated from any of the Patchworks translators must be customized to link with the spatial dataset it will describe. Let's have a look at the xml file that we just generated. Default values are assigned when you convert from a Woodstock file, so you will have to change these to match your fragment (inventory) fields.

the section called “XML Forest Models” explains in more detail each of the components of the Forest Model. We will not be adding any extra features to this XML file so we will not go into any detail here. We can simply edit the beginning of the XML file to suit our needs and build the matrix to finish building our data model.

[Note]Note
  1. Open up the C5.xml file in your favourite text editor

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE ForestModel PUBLIC "ForestModel" 
    "http://www.spatial.ca/ForestModel.dtd">                  1
<!--

      Woodstock to Patchworks conversion

      Woodstock input file: C:\Program Files\Spatial Planning 2
      Systems\Patchworks\QuickTourIII\woodstock\C5_Feb02.pri
      Conversion date:   June 13, 2008 10:28 AM
      Program version:   1.3 (Wed Jun 11 13:34:15 EDT 2008)
      Period width used: 5

-->


<ForestModel description="Woodstock conversion" 
    horizon="200" year="2008" match="multi">                  3

 <input block="BLOCK" area="AREA" age="AGE" />                4

  <output  messages="messages.csv" blocks="blocks.csv"
     features="features.csv" products="products.csv"
     treatments="treatments.csv" curves="curves.csv"
     tracknames="tracknames.csv" />                           5

<!--
  Define required database columns                            6
-->
  <define field="theme1" column="Upper(String(THEME1))" />
  <define field="theme2" column="Upper(String(THEME2))" />
  <define field="theme3" column="Upper(String(THEME3))" />
  <define field="theme4" column="Upper(String(THEME4))" />
  <define field="theme5" column="Upper(String(THEME5))" />       
  <define field="treatment" />

<!--
  Define Woodstock 'Aggregates'                               7
-->
  <define field="T1_ELIG" constant="'P1,ST'" />
  <define field="T2_PINE" constant="'Y4,Y3,Y2'" />
  <define field="T2_D" constant="'Y8,Y9'" />
  <define field="T2_SPRUCE" constant="'Y7,Y6,Y5'" />
  <define field="T2_C" constant="'Y7,Y6,Y5,Y4,Y3,Y2,Y1'" />
                                  

1

The document type definition (DTD) is the Forest Model. The DTD helps XML-aware software tools understand the syntax of the ForestModel language.

2

Comments that provide a record of the Woodstock input model and conversion parameters

3

The planning horizon is 200 years starting at 2008.

4

The inputs that will be used by the Matrix Builder from the fragments file. These always need to be edited to match the fields of your fragments file (see below).

5

A list of the output files that will be generated from the Matrix Builder and will make up the data model.

6

Definition of your fragments file fields that will be required to be read in to match attribute information in the XML file.

7

The Woodstock aggregates are defined here.

[Note]Note
  1. In your text editor, change the input element parameters from:

    • <input block="BLOCK" area="AREA" age="AGE"/>

    • To: <input block="BLOCK" area="AREA/10000" age="F_AGE" exclude="BLOCK=0"/>

  2. Save your changes to the C5.xml.

The XML file we generated from our aspatial Woodstock model now points to the proper fields of the spatial dataset. We can now join the two together using the Matrix Builder.

[Important]Important

The ForestModel is formally described by a document type definition (DTD). For advanced programmers, there is a copy of this in the Patchworks installation folder of your Patchworks software.