3.1 LESSON 3 – Basic Analysis Tools This lesson presents some basic analysis tools for vector data available in TerraView. In this lesson, we are going to use Tutorial database built during lessons 1 and 2. 3.1 Queries TerraView provides two kinds of queries: based on attribute values of Theme objects and queries based on spatial relations among object geometries. 3.1.1 Attribute Query To activate Attribute Query interface, shown in Figure 3.1, right click on a Theme (Districts Theme in this example) and choose Attribute Query … option. Execute the following steps to define an attribute query: 1. Select the attribute that will be used in the query. 2. Express the attribute query criteria using a combination of the operators described bellow: a. Mathematical: sum (+), subtraction (-), multiplication (*) and division (/) b. Logical: greater (>), lesser (<), greater or equal (>=), lesser or equal (<=), equal (=) and different (<>) c. Existence/absence of null values: there is value in the column (IS NOT NULL) and there is no value in the column (IS NULL) d. Likeness: likeness in text attributes (LIKE) e. Logical connectors: and (AND), or (OR), not (NOT) f. Special characters: simple inverted commas to delimit text values (‘) and percentage character to use with the LIKE operator (%). For example, to select all districts whose name (DENO attribute) begins with ‘Ca’, you should type: DENO LIKE ’Ca%’ g. UNDO and REDO buttons help the building of selection criterion by undoing and redoing the most recent actions. DEL button deletes a selected text in the edit area, as seen in item 4. 3. List all values of the selected attribute in item 1. To list these values, tick the box next to Attribute Values option. These values are used to help you build the selection criteria. National Institute for Space Research - INPE – Image Processing Division 3.2 4. Instead of using the list and buttons described above, you can directly type the selection criterion in the editable frame, following the SQL where clause syntax. 5. Click on New Query button to apply the query criterion on all Theme objects, ignoring objects previously selected. 6. Click on Add button to append the queried objects to the objects previously selected. 7. Click on Filter button to apply the query criterion over the Theme objects previously selected only. Figure 3.1 – Attribute Query. Districts Theme has an attribute named MORT_INFANTIL that contains infant deaths rate in each district. In order to select only the districts in which infant deaths rate is between 10.0 and 19.0, you should execute an attribute query over the Districts Theme (Note: these attribute values are fictional). Click on Districts Theme and choose Attribute Query… option. In Attribute Query interface, select MORT_INFANTIL attribute, describe the criteria, as shown in Figure 3.1, and click on New Query button. Objects selected by this attribute query are presented in Figure 3.2. Their geometries are highlighted using a different color in the Draw Area, as well as their attributes in the Grid Area. Exercise: Execute other attribute queries on districts theme and verify the results. National Institute for Space Research - INPE – Image Processing Division 3.3 In order to remove the specific color of queried objects, click on icon. To change color of queried objects, apply the visual changing procedure described in Lesson 2 using Visual → Query... option. Figure 3.2 – Result of an attribute query. 3.1.2 Spatial query Spatial query is based on the spatial relation among object geometries of one or two Theme. To activate Spatial Query interface, right click on the active Theme and choose Spatial Query… option. This interface provides a set of topological operators based on the geometrical representation of the themes involved in the query, as shown in Figure 3.3. a) Spatial query over one Theme: change Theme status to active and access Spatial Query interface from it. Here, we are going to use Districts Theme. National Institute for Space Research - INPE – Image Processing Division 3.4 Figure 3.3 – Spatial Query over a Theme. In this interface, follow the steps presented below: 1. Click on one or more districts or query to select some objects. These objects will be used in the Spatial Query. The topological operator will be applied on these pointed districts against the other districts. 2. Choose one of the enabled topological operators in Topological Relations frame. In this example, choose Touch ( ) operator. Observe that, as the active Theme contains polygons, only topological relations among polygons are available. 3. Click on New Query button to apply the spatial query on all Theme objects, ignoring objects previously selected. After that, observe the result. 4. Add button appends queried objects to the ones previously selected. 5. Filter button applies the spatial query on only Theme objects previously selected. 6. Note: In Tolerance field you can inform the precision value in the same unit of data projection. This value is used by geometrical functions. Observe that the query result highlights all objects that touch the pointed objects using a different color. National Institute for Space Research - INPE – Image Processing Division 3.5 Exercise: Execute new spatial queries over other themes, trying out other topological operators. Spatial query on two themes: as an example of the spatial query on two themes, tick all view themes to make them visible and activate Spatial Query interface from Districts Theme, as shown in Figure 3.4. Figure 3.4 – Spatial Query on two themes. In this interface, follow the steps described below: 1. Click on some districts which contain subway or railway stations or which are crossed by roads. These pointed districts will be used in the spatial query, that is, the topological operator will be applied on them against other objects from another Theme. 2. Tick Visible Themes option to enable the list of visible themes. Then, choose a Theme in this list to be used in the spatial query. In this example, choose Subway_stations Theme. 3. Choose one of the enabled topological operators. Observe that, since the active Theme Districts has polygons and the visible Theme Subway_stations National Institute for Space Research - INPE – Image Processing Division 3.6 has points, the interface enables only the set of topological operations between points and polygons. In this example, choose Within ( ) operator. 4. Click on New Query button. Observe that the query result highlights, using a different color, all subway stations (visible Theme) that are within the districts (active Theme) pointed in the step 1. Exercise: choose another visible Theme in the step 2 and execute other spatial queries, trying out different topological operators. 3.2 Grouping Objects or Creating Legends Theme objects can be grouped based on their attribute values. This operation is also called Legend Creation. In order to activate Legend Editor interface, which is responsible for creating legends and is shown in Figure 3.5, right click on Districts Theme and choose Edit Legend…option. 1 3 2 4 5 Figure 3.5 – Interface to group Themes. National Institute for Space Research - INPE – Image Processing Division 3.7 To create legends: 1. Choose grouping parameters: a. Mode that will be used to group attribute values. Available grouping modes in TerraView are: 1. Equal Steps: the interval of existing values [minimum and maximum values] is divided in n equal size intervals. Each interval is associated to a group; 2. Quantil: the value interval of each group is calculated in such a way that each group contains approximately the same number of objects; 3. Standard Deviation: the intervals associated to the groups are calculated based on the standard deviation of the objects. Therefore, you should choose a proportion (1, 0.5 or 0.25) of the standard deviation that will be associated to each group. Notice that the number of groups is not defined by the user but depends on object attribute values; 4. Unique Value: each attribute value is associated to a group. Grouping modes Equal Steps, Quantil and Standard Deviation can be applied only to numerical values. On the other hand, grouping mode Unique Value can be applied on numeric and text values. In this example, choose Equal Steps mode. b. Choose the attribute that will be used to group objects. In this example, choose POP_FAVELADA attribute. c. Choose the number of groups or Slices to be created. In this example, choose 5 groups. d. Choose the Precision - the number of decimal numbers that will be considered for the numeric values. e. If you select Standard Deviation mode, inform the proportion to be used (1, 0.5 or 0.25). 2. Choose the colors that will be used in the legends visual through the color bar. To select 5 different colors, one for each group, execute the following steps: a. Right click on the color bar and select Add Color...option. National Institute for Space Research - INPE – Image Processing Division 3.8 b. Select a new color and click OK. After that, the color bar shows the selected color. c. Repeat steps a to b four times, selecting five different colors. d. Click on Equal Space button to define a sequence of colors with a smooth transition between then. Note: The color bar needs at least one color. You can change color order in the bar by dragging the color to a new position, using the vertical cursor (indicated by 1 in Figure 3.6). You can change or delete colors using the menu obtained by right clicking on a color. The horizontal cursor (indicated by 2 in Figure 3.6) allows you to increase or decrease color brightness. Once you have created a color bar it can saved under a given name (using Save button), and later recover the color bar in another grouping operation (using the field indicated by 3 in Figure 3.6). Figure 3.6 – The color bar interface. 3. Click on Apply button to calculate the groups. 4. A table at the bottom of the interface shows the groups and their: interval values, visual, label, and number of objects associated to each group. You can change the interval values and the label associated to each group, by editing these fields in the table, and the visual associated to each group by double right clicking on the first field. 5. Click OK button to execute the grouping of the Theme objects. 6. A grouping created for another theme can be cloned if the Theme has the same attribute that has been grouped. Figure 3.7 shows the result of grouping the Theme. Observe that in the Themes Tree the legend with the color associated to each group and their labels are presented. National Institute for Space Research - INPE – Image Processing Division 3.9 Figure 3.7 – Grouping result. 3.2.1 Handling Legends After grouping Theme objects, the legends can be accessed through Themes Tree and you can change characteristics of the legend through the options available by right clicking on the legend name (Figure 3.8a) or on the legend items or groups (Figure 3.8b). (a) (b) Figure 3.8 – Handling legends. 1. To change grouping parameters, use Edit Legend... option. This option activates the interface shown in Figure 3.9. 2. To remove grouping, choose Remove Legend option. National Institute for Space Research - INPE – Image Processing Division 3.10 3. To define an alias, that is, an alternative name for the legend, choose Set Alias option. In addition, to remove an alias, use Remove Alias option. 4. To change color and label of a legend item or group, use Rename Legend... option and Change Visual (see Figure 3.9), respectively. Figure 3.9 – Legend Visual interface. In addition, you can display the legend in the Draw Area. To do this, right click on the Theme with the legend to display and select Visibility of the Representation… option. This option activates the interface shown in Figure 3.10. Figure 3.10 – Representations Visibility Interface. After that, execute: 1. Tick Grouping and Legends boxes. 2. Click on OK button. National Institute for Space Research - INPE – Image Processing Division 3.11 Observe that the legend is displayed in the left upper corner of the Draw Area, as presented in Figure 3.11. Figure 3.11 – Legend in the Draw Area. In order to move the legend to another appropriate position, activate Edition Cursor through icon, click on the legend, keep the mouse right button pressed down, and drag it to a new position. After moving, activate Pointer Cursor. Exercise: Remove this legend and try to execute other grouping, using a different attribute, grouping mode, and colors. 3.3 Creating Bar and Pie Charts Using the objects grouping described in the previous section, we can have a general view of the data. Bar and pie charts allow us to compare two or more attributes of each object. In order to activate Edit Bar or Pie Charts interface shown in Figure 3.12, right click on Districts Theme and select Edit Bar or Pie Charts… option. National Institute for Space Research - INPE – Image Processing Division 3.12 Figure 3.12 – Editing Bar or Pie Charts. To create a chart follow the steps described below: 1. Select chart Type: bar or pie. In this example, choose Bar Chart. 2. Choose the attributes to be used in Chart Items frame. Select attributes in Attribute list and click Insert button. To remove a selected attribute, click on its row number and click on Remove button. In this example, select two attributes POP_FAVELADA and MORT_INFANTIL. 3. Define chart dimensions: a. For bar chart, define its Maximum and Minimum Height and its Width, expressed in screen pixels; b. For pie chart, define its Maximum and Minimum Diameter, expressed in screen pixels; c. You should tick Fixed Size option when you do not want the chart size to change with the Zoom operation. 4. For pie charts, you can choose an attribute that the pie diameter will be Proportional to. 5. Input item allows us to create charts of some objects only. 6. Click OK. National Institute for Space Research - INPE – Image Processing Division 3.13 Observe the resulting chart in Figure 3.13. You can analyze the proportion between two variables of each district. Right click on the label of the bar or pie chart, or on each item to access the option to redo the charts, delete charts, or define other names for the chart variables. The same instructions about how to display and edit graphic legend in the Draw Area, shown in section 3.2.1, are also applicable here. Figure 3.13 – Bar chart. Exercise: Remove the bar chart and create a pie chart. After that, change its visual. 3.4 Creating graphs Bar and pie charts allow us to analyze each object. On the other hand, graphs allow us to analyze how the attributes vary for all objects and only one graph associated to all Theme objects is created. In order to create a graph, right click on Districts Theme and select Graphic Parameters… option to activate the interface shown in Figure 3.14. National Institute for Space Research - INPE – Image Processing Division 3.14 Figure 3.14 – Interface Graphic Parameters. To create a graph, follow the steps below: 1. Select Graph Type: a. Histogram: calculates n slices, where each slice is associated to a value interval, and displays the number of objects in each slice. b. Normal Probability: displays how close to a normal distribution the variation of the attribute selected in step 3 is. c. Dispersion: displays the relation between two attributes. In this example, choose Histogram. 2. For Histogram and Normal Probability graph types, you should inform the number of slices that will be created in Slices Number list. In this example, choose 30 slices. 3. Select an Attribute that will be used to build the graph. To build a Dispersion graph, it is necessary to select two attributes to be used for values in x and y axes. In this example, choose POP_FAVELADA attribute. 4. Choose which Theme Objects will be used to build the graph. Here choose “All”. 5. Click OK. Observe the Histogram graph created in the Graphic Display Area. In order to display graph and data simultaneously, click on the button to tile the Draw Area and the Graphic Display Area side by side, as seen in Figure 3.15. National Institute for Space Research - INPE – Image Processing Division 3.15 Figure 3.15 – Graph of an Attribute. 3.5 Using the Brushing Tool After creating a graph on a Theme and displaying the graph and the data simultaneously, as shown in Figure 3.15, TerraView provides a brushing tool. This tool is responsible for displaying, in an integrated way, object geometries, its attributes and its location in the graphic. To use this tool, follow the steps described below: 1. Activate Graphic cursor pressing icon. 2. Put the cursor on the graph, observing the histogram peaks that the cursor intersects, as presented in Figure 3.16. 3. If you want to change cursor size, move the cursor keeping the ALT key pressed down. 4. After defining cursor size, locate it on some histogram peaks, and right click on them. Observe the result in Figure 3.17. Observe that objects associated to selected histogram peaks are highlighted in Grid Area and Draw Area. National Institute for Space Research - INPE – Image Processing Division 3.16 Figure 3.16 – Graph cursor. Figure 3.17 – Brushing tool. Exercise: create other graphs and try out the brushing tool on them. 3.6 Dispersion 3D Plot The plot works in a similar way to the 2D dispersion plot with the difference of using three attributes for each Theme object. It is necessary to select or highlight three variables in the attributes table to make the "Dispersion 3D" option available in the context menu activated by right clicking on one line of the attributes table. The selected columns are assigned to x, y, and z axis, respectively. To change the assignments it is necessary to swap table columns and, after that, start the Dispersion 3D interface. To create a Dispersion 3D plot, execute the following steps: 1. Import the shapefile Cidades_PR_1997.shp, using the procedure described in Lesson 1. National Institute for Space Research - INPE – Image Processing Division 3.17 Figure 3.18 – Importing shapefile. In this interface, inform the parameters executing the steps below: - Select a projection in the available Projections list. In this case, select Lat Long projection. - Select a Datum in the available Datum list. In this case, select SAD69. - Click OK. To finish the import, answer Yes to the question about visualizing the imported data. 2. Select the three attribute table columns of the Cidades_PR_1997 Theme that will provide the values of the x, y, and z axis to be used to create the graph, and choose "Dispersion 3D" in the context menu activated by right clicking on one of the attributes table lines, as shown in the Figure below. National Institute for Space Research - INPE – Image Processing Division 3.18 Figure 3.19 – Displaying Dispersion 3D interface. 3. The Dispersion 3D interface will be displayed and it contains four visualization areas. The main area shows the data plotted in three dimensions and the other areas show the same data plotted in a bidimensional plane. Figure 3.20 – Dispersion 3D Interface. National Institute for Space Research - INPE – Image Processing Division 3.19 Dispersion 3D interface functionalities: - Viewing Control field includes the commands to change the way 3D data id visualized. Displaying three-dimensional data in a bi-dimensional screen requires controls to visualize the data from different angles and positions: o Show Axis controls the display of x, y, and z axis. Figure below shows the interface without axis display. Figure 3.21 – Dispersion 3D plot without x, y, and z axis. o Quality slider controls the quality of the 3D points plotting. Each point is represented by a sphere and the slider controls the drawing quality of these spheres. The lower the quality, the faster the draw. o Zoom slider controls the main area zoom. o Lighting can be set to be from Front or Back. o Rotation field sliders X, Y, and Z controls the respective rotations in x, y, and z. Rotation commands can also be executed by mouse. Tip: press alt key together with the mouse left button controls the rotation in x, y, and z. When using LINUX, the Alt key must be used with the Ctrl key. National Institute for Space Research - INPE – Image Processing Division 3.20 Figure 3.22 – 3D Dispersion Plot with zoom and rotation. - Selection Control box commands change the start position and the size of the selection hexagon. Selection hexagon is always displayed in magenta. - Offset and Size boxes sliders control the start position and the size of the hexagon in x, y, and z. Figure below shows the hexagon in a new position. All selection controls can be executes using the mouse in the three bi-dimensional screens. Offset control is executed by locating the mouse at the center of any screen rectangle and dragging the rectangle to a new position. Size changed by moving the mouse close to the edges of the rectangle. Figure 3.23 – Selection hexagon in a new position and with a new size.. - Every time the selection rectangle is changed, a query command is executed to select all objects inside the hexagon. However, when the hexagon is changed by mouse, the option to reposition without executing a query is available. Use National Institute for Space Research - INPE – Image Processing Division 3.21 Ctrl key. In addition, the new selection can be added to the current selection by using Shift key. Figure 3.24 – Hexagon located on some 3D points. Figure 3.25 – Hexagon on some 3D points with a new perspective view. - The module also allows the analysis of a data subset such as: All, Queried, Not Queried, Grouped, and Not grouped. National Institute for Space Research - INPE – Image Processing Division 3.22 Figure 3.26 – List with input options. - In addition, the module allows the analysis of data with cardinality 1 to n. When aggregation function is not used, all data are plotted in the interface. When an aggregation function is used, data can be summarized by: MIN, MAX, AVG, SUM, and COUNT. Figure 3.27 – List with aggregation functions. National Institute for Space Research - INPE – Image Processing Division
© Copyright 2026 Paperzz