A spatial frame is simply a layer that describes only the geographic character of features and not their attributes. In raster, as with vector, this spatial frame is bound by the minimum and maximum X and Y coordinates, but with raster its attributes are tied to the actual pixel values.
And as we worked with in earlier exercises, a raster group file is essentially a simple collection of raster layers. The case of vector layers is very different in concept. A single vector layer acts as a spatial frame but its attributes can be associated with a data table of statistics for the features depicted. By associating a data table with attribute data for each feature, a layer can be formed from each such data field. Although simple vector layers can exist, the power of associating unique vector features to a collection of attributes in a table is the hallmark of vector GIS.
In TerrSet we accomplish this association between a vector spatial frame and a collection of attributes with our Database Workshop facility.
Our native database format for storing attribute data is in Microsoft Access (.accdb) format. In these remaining exercises we will explore the use of vector collections and Database Workshop.
A
Remove all map windows from the screen by choosing Close All Windows from the Window List menu.B
Bring up DISPLAY Launcher and choose to display a vector layer. Then click on the Pick List button and find the entries named MASSTOWNS. The first one listed is a spatial frame, while the second (with the + sign beside it) is a layer collection based on that spatial frame. Select the layer named MASSTOWNS (the one without the plus sign). Click the legend option off and then go to the Advanced Palette/Symbol Selection tab. A spatial frame defines features but does not carry any attribute (thematic) data. Instead, each feature is identified by an ID number. Since these numbers do not have a quantitative relationship, click on the data relationship button for Qualitative. Then select the Variety (black outline) color logic option and click OK. The state of Massachusetts in the USA is divided into 351 towns. If you click on the polygons with Identify, you will be able to see the ID numbers.Now run DISPLAY Launcher again to display a vector layer and locate the vector collection named MASSTOWNS1 (look for the + sign beside it). Click on either the + sign or the MASSTOWNS filename, and notice that a whole set of layer names are then listed below it. Select the layer named POP2000. Ensure that the title and legend are checked on. Then select the Advanced Palette/Symbol Selection tab. The data in this layer express the population in the year 2000. Since these data clearly represent
1 There is no requirement that the spatial frame and the collection based upon it have the same name. However, this is often helpful in visually associating the two.
EXERCISE 1-9 DATABASE WORKSHOP: WORKING WITH VECTOR LAYERS 50
quantitative variations, select the Data Relationship to be Quantitative. Then set the color logic Unipolar (ramp from white). We will use the default symbol file named PolyUnipolarWred. Then click OK.
Unipolar color schemes are those that appear to progress in a single sequence from less to more. You can easily see this in the legend, but the map looks terrible! The problem here is that the population of Boston is so high compared to all other towns in the state, the other towns must appear at the other end of the color scale in order to preserve the linear scaling between the colors and the data values. To remedy this, click on Layer Properties and change the autoscaling option to be Quantiles. Then click OK.
As you can see, the quantiles autoscaling option is ideally suited to the display of highly skewed distributions such as this. It does it by rank ordering the towns according to their data values and then assigning them in equal groups to each of a set of classes.
Notice how it automatically decided on 16 classes. However, you are not restricted to this. You can choose any number of classes up to 16.
MASSTOWNS is a vector layer collection. In reality, the data file with the + sign beside it is a vector link file (also called a VLX file since it has a “.vlx” extension, or simply a “link” file). A vector link file establishes a relationship between a vector spatial frame and a database table that contains the information for a set (collection) of attributes associated with the features in the spatial frame.
C
To get an understanding of this, we will open TerrSet's relational database manager, Database Workshop. Make sure the population for 2000 (MASSTOWNS.POP2000) map window has focus (click on its banner if you are unsure—it will behighlighted when it has focus). Then click on the Database Workshop icon on the tool bar (an icon with a grid-like pattern on the right side of the toolbar). Ordinarily, Database Workshop will ask for the name of the database and table to display. However, since the map window with focus is already associated with a database, it displays that one automatically. Click on the map window to give it focus and then press the Home key to make it the original size. Then resize and move Database Workshop so that it fits below the map window and shows all columns (it will only show a few rows).
Notice also the relationship between the title in your map window and the content of Database Workshop. The first part specifies the database that it is associated with (MASSACHUSETTS.ACCDB); the second part indicates the table (Census 2000) and the third part specifies the column. The column names of the table match the layer names included in the MASSTOWNS layer collection in the Pick List in DISPLAY Launcher (including POP2000). In database terminology, each column is known as a field.
The rows are known as records, each of which represents a different feature (in this case, different towns in the state). Activate Identify mode and click on several of the polygons in the map. Notice how the active record in Database Workshop (as indicated
EXERCISE 1-9 DATABASE WORKSHOP: WORKING WITH VECTOR LAYERS 51
by position of the highlighted cell) is immediately changed to that of the polygon clicked. Likewise, click on any record in the database and its corresponding polygon will be highlighted in the map.
D
When a spatial frame is linked to a data table, each field becomes a different layer. Notice that Database Workshop has an icon that is identical to that used for DISPLAY Launcher. If you hover over the icon with your mouse, the hint text will read Display Current Field as Map Layer. As the icon would suggest, this can be used as a shortcut to display any of the numeric data fields. To use it, we need to choose the layer to display by simply clicking the mouse into any cell within the column of the field of interest.In this case, move over to the POPCH80_90 (population change from 1980 to 1990) field and click into any cell in that column.
Then click the Display Current Field as Map Layer icon on Database Workshop. As this is meant as a quick display utility, the layer is displayed with default settings. However, they can easily be changed using the Layer Properties dialog.
There are four ways in which you can specify a vector layer for display that is part of a collection. The first is to select it from the Pick List as we did to start. The second is to display it from Database Workshop. Thirdly, we can use DISPLAY Launcher and simply type in the name using dot logic. Finally, we can display a part of a collection from TerrSet Explorer, very much the same way as we did in DISPLAY Launcher, by opening up the “.vlx” file and displaying one of the numeric fields. Notice the names of the two layers currently displayed from the MASSTOWNS collection (as visible both in Composer and on the Map Window banners). Each starts with a prefix equal to the collection name, followed by a dot ("."), followed by the name of the data field from which it is derived. This same naming convention can be used to specify any layer that belongs to a collection. You may now close the map windows and Database Workshop.
E
How is a vector layer collection established? It is done with the facility in Database Workshop with the “Establish Display Link”option. This can be launched from an icon in Database Workshop or from the Query menu. If it is not already open, open the MASSTOWNS.VLX database file in Database Workshop. Make sure that the Census 2000 table is selected, then open the Establish Display Link dialog.
Notice that a vector link file contains three components—the name of the vector spatial frame, the database file, and the link field.
The spatial frame is any vector file which defines a set of features using a set of unique integer identifiers. In this case, the spatial definition of the towns in the state of Massachusetts, MASSTOWNS.
The database file can be any Microsoft Access format file. In cases where a dBASE (.dbf) file is available, Database Workshop can be used to convert it to Access format. This vector collection uses a database file called MASSACHUSETTS.ACCDB.
The link field is the field within the database table that contains the identifiers that link (i.e., match) with the identifiers used for features in the spatial frame. This is the most important element of the vector link file, since it serves to establish the link between records in the database and features in the vector frame file. The Town_ID field is the link field for this vector collection. It contains the identifiers that match the feature identifiers of the polygon features of MASSTOWNS.
Note that database files can contain multiple tables and can be relational. The VLX file also stores from which table the VLX was created. In this case, the CENSUS2000 table is used.
Our intention here is simply to examine the structure of an existing VLX file.
Once a link has been established, we can do more than simply display fields in a database. We can also export fields and directly create stand- alone vector or raster layers.
EXERCISE 1-9 DATABASE WORKSHOP: WORKING WITH VECTOR LAYERS 52
F
Similar to displaying any field, place the cursor in the field you wish to export (in this case choose the POPCH90_00), then select from the File/Export/Field/to Vector File menu option. The Export Vector File dialog allows you to specify a filename for the new vector file and the field to export. Notice also that it creates a suggested name for the output file by concatenating the table name with the field name. If the field name is correct, click OK to create the new vector file. Otherwise, choose the correct field and click OK. The new vector file reference parameters will be taken from the vector file listed in the link file.Notice that the toolbar in Database Workshop has an icon for rapid selection of the option to create a vector file (fifth from the left). Similarly there is one for exporting a raster layer (fourth from the left). Again, place the cursor in the field you want to export (in this case, choose the AREA field) and then click the Create IDRISI Raster Image icon. You will be asked to specify a name for the new layer. You can choose the suggested name and click OK. This will then yield a new display regarding reference parameters.
Recall that a vector link file defines the relationship between a vector file as a spatial layer frame and a database as the vector collection of data. Because we are exporting to a raster image, we will need to define the output parameters for a different type of spatial layer frame. After defining the output filename, you will then be prompted for the output reference parameters. By default, the coordinate reference system and bounding rectangle will be taken from the linked vector file. What we need to define is the number of columns and rows the image will span. In addition, we may need to make adjustments necessary to match the bounding rectangle to the resolution of cells. However, as it turns out, we already have a raster image with the exact parameters we need, called TOWNS. Therefore, click on the Copy from Existing File option and specify TOWNS. You will then notice that it specifies 2971 columns and 1829 rows (i.e., 100 meter resolution). Now click OK and the image will be autodisplayed.
G
Finally, with the link established, we can also import data to existing databases. From DISPLAY Launcher, display the raster image STATEENVREGIONS, using the palette of the same name.The state has been divided into ten ‘state of environment’ regions. This designation is used primarily for state buildout monitoring and analysis. We will now create a new field in the CENSUS2000 table and update that table to reflect each town’s environmental region code. Using the raster image, we will import this data to a new field.
With the CENSUS2000 table selected, choose Add Field from the Edit menu. Call the field ENVREGION with a data type of integer. You will notice that it adds this new field to the far right of the table. Then from the File menu in Database Workshop, go to Import/Field/from Raster Image. From the Import Raster dialog, enter TOWNS as the feature definition image and
STATEENVREGIONS as the image to be processed. Select Max2 as the Summary type and Update existing field for Output. For the link field name, enter TOWN_ID and for the update field name, enter ENVREGION. Finally, click OK to have the data be imported.
The result is added to the new field in the database. The new values contain the state environmental regions. Thus, each town in the table now has assigned its region value in this new field.
We have just learned that collections of vector layers can be created by linking a vector spatial frame to a data table of attributes. In the next exercise we will explore how this can facilitate certain types of analysis.
2 All of the pixels within each region have the same value, so it would seem that most of these options would yield the same result. However, to hedge against the possibility that some pixels near the edge may partially intersect the background and be assumed to have a value of 0, the choice of Max is safest.