Skip to content

Query Window

Sam Gillingham edited this page Jul 20, 2023 · 2 revisions

Table of Contents

Explaining the Query Window

This Query Window can be 'docked' with a Viewer by double clicking the title bar.

The Query Window has 2 modes - one for continuous data, and one for thematic data with an attribute table. Features that require thematic data are marked with [TD].

For continuous data, the user is presented with a table containing the values of all the bands at the last location clicked. There is also a graph of this data available under the 'Plot' tab.

For thematic data, the attribute table for the displayed band is shown. There are also functions available when right-clicking the column headers.

Toolbar Buttons

The tool buttons are now described from left to right:

Follow Query Tool

Enabled by default. When enabled the Query Window updates when a new point is clicked. You may wish to disable this when you have multiple Query Windows open so that you can view results for different areas easily.

Change Cursor Color

Change the color that the cursor is displayed in

Increase Cursor Size

Make the Cursor bigger

Decrease Cursor Size

Make the Cursor smaller

Highlight Selection

[TD] Enabled by default. When enabled and rows of the attribute table are selected, the areas on the image corresponding to these rows are highlighted using the current highlight colour. You may wish to disable this so you can see what the original colours are for the selected rows.

Change Highlight color

[TD] Change the color that areas corresponding to highlighted rows are drawn in.

Remove Current Selection

[TD] Remove selection on rows.

Select All

[TD] Make all rows in attribute tables selected.

Select using Expression

[TD] This button brings up a window that allows you to select rows based on an expression. The supplied expression is executed by Python. All the columns are supplied as numpy arrays - their names are matched by Python variables (case sensitive). It is expected that your fragment of Python return a boolean array - most simply using a numpy comparison expression (eg 'Green < 100'). If multiple expressions are required, enclose each one in brackets and combine with the '&' or '|' operators (eg '(Green < 100) && (Red < 200)').

Note that although the variables are numpy arrays, be careful using functions such as min(), mean() as your function will be evaluated multiple times - once for each 'block' of attribute values.

The intention is that once you have obtained the thresholds you require for the classification you can use the numpy expression that was used in conjunction with the RIOS 'ratapplier' module to create a processing script that can process all your images.

Some special values are also available:

  • 'row' is a numpy array that contains the row numbers
  • 'isselected' is a boolean numpy array that has True where rows are selected. This allows you to perform calculations that take account of the already selected rows (for example use the min() of them etc).
  • 'lastselected' is a boolean numpy array. This can be used to to get information on the previous selection, for example, before a geographic select. Or can be used as an 'undo'

Toggle Editing Mode

[TD] Toggles edit mode. Some functions (marked with [Update] below) are only available when the file is opened in update mode and are greyed out otherwise. This button allows you to toggle if the dataset is in update mode.

Add Column

[TD][Update] Adds a column to the attribute table. You will be asked for the type and the name. The changes are not written to the file until the 'Save Edited Columns' button is pressed (below).

Save Column Order

[TD][Update] If you have changed the column display order (see the column header menu below) you can save this order back to the file so that the next time you open the file the columns are in the same order. Note that this does not actually re-order the columns in the attribute table, it just notes the preferred order in the file metadata and this is read next time the file is opened.

Geographic Select by Polygon

[TD] This selects rows that correspond to areas of the image which the user selects. Once you have clicked this button you can then create a polygon on the Viewer window by clicking the left mouse button on the corners of the polygon. Use the right mouse button to finish.

Hold the Control button down when you click the right mouse button so they previous selection does not get removed - ie you add the new area to the rows selected.

Geographic Select by Line

[TD] Same as 'Geographic Select by Polygon' but rows are selected on the basis of your line touching their corresponding areas on the image. The Control button trick works here too.

Geographic Select by Line

[TD] Same as 'Geographic Select by Polygon/Line' but just selects a single point and the corresponding row. The Control button trick works here too.

Switch between map and pixel coordinates

Toggles the coordinates display between map and pixel coordinates.

Display Plot Labels

Toggles the display of the plot labels on the plot tab. When enabled the points on the plot are labelled with the name of each band.

Save Plot

Allows you to save the plot as a PDF.

Set Plot Scaling

Allows you to override the scale used in the plot. Useful if you are comparing different areas.

Column Header Menu

In thematic mode there is a menu that appears when you right click a column header. The functions in this menu act upon the column that was right-clicked on.

Edit Selected Rows in Column

[Update]Allows you to set the selected rows in the column to a value or values. You supply a Python expression that is then evaluated to get the value(s) to assign to the column. Like the 'Select using Expression' button above, the columns are available as numpy arrays. Either supply a constant to have all selected rows set to that value or an expression that includes other column(s) to set different values to different rows (eg 'column_a * 3'). The same special values are also available.

This is intended to allow you to save intermediate values, or just do a classification on a single image. For processing multiple images the RIOS 'ratapplier' module is highly recommended.

Note that although the variables are numpy arrays, be careful using functions such as min(), mean() as your function will be evaluated multiple times - once for each 'block' of attribute values.

Move Left

Move Right

Move Left Most

Move Right Most

These all apply to the order of the selected column relative to the rest of the attribute table. To save the order for next time see the 'Save Column Order' button above.

Set number of decimal places

This is enabled for floating point columns and allows you to set how many decimal places are displayed in the table.

Set Column as Color Table Lookup

If additional colour tables have been saved to the current file (see Surrogate Color Tables) you can set a column to be a lookup into one of these colour tables for display using this menu option. If more than one additional colour table has been saved you will be asked which one to use. A value of zero in the column will be ignored and the standard colour table used for that row. This feature can be handy if you need to swap between colour tables for some reason. For example you might have different colour tables for classified and unclassified, and as you classify the data (change from zero) in a column the colour changes. Also you might have different columns having classification at different dates and be able to colour the imagery based on a particular date/column.

Set Column to receive keyboard edits

[Update]For manual classification. When this is set keyboard input is processed by the Query Window and put into the the specified column for rows that are selected. Input is separated by Enter. You can then do a Geographical Select and set all rows to a value, then do another select and so on.

Color Column

If there are Red, Green, Blue and Alpha columns defined for a file an artificial column named 'Color' will be created that is always the left most column. This column has color squares that show the colour that each raw has been assigned. This column has a different menu with just one option: 'Set color of selected rows'. This brings up a dialog that allows you to select a color. The selected rows then have this color set. The map window is also updated. Note that you can also change the Red/Green/Blue/Alpha columns with values directly and the map window gets updated also.