Query Tool Commands

Description

Details the syntax for commands available for use in Query Tool scripts.

Requirements

Solve module

Conventions

The following conventions are used when describing the syntax of the commands:

Convention Used for
UPPERCASE Query language commands.
italic User supplied parameters.
bold Keywords - text that must be typed exactly as shown.
| Separates syntax items enclosed in brackets or braces. You can only use one of the items.
[ ] Optional syntax items. Do not type the brackets.
{ } Required syntax items. Do not type the braces.
[...n] An indication that the preceding item can be repeated. Do not type [..n]
Commands

The following commands are available:

Comment

Syntax:

Add a comment to describe what certain sections of a query script is doing.
// [ user_entered_comment ]

Example:
// Set the active layer to 'Vegetation'
set active layer 'Vegetation'


Declare

Syntax:

Define a variable that can be referenced later in a query script. The name must be alphanumeric and can contain underscores.
DECLARE @name { text | integer | real4 | real8 | datetime | boolean } value

Example:
// Set the active layer to 'Vegetation'
declare @LayerName text 'Vegetation'
set active layer @LayerName


Set

Syntax:

Set the active layer and turn on the visibility of the layer.
SET active layer { 'layer_name' | unique_layer_id }

Control the visibility of a layer.
SET visibility layer { all | 'layer_name' | unique_layer_id | 'layer_group_name'} { on | off }

Control the visibility of graphical objects.
SET visibility { all | point | line | alignment | polygon | block | shape | text | image | terrain } { on | off }

Examples:
// Set the active layer to 'Vegetation' and turn on the layers visibility
set active layer 'Vegetation'
// Turn off the 'Road' layer and all text objects
set visibility layer 'Road' off
set visibility text off
// Turn off all layers including the active layer'
set visibility layer all off
// Turn off all layers except those in a layer group called 'Feature Plan'
set visibility layer '*' off
set visibility layer 'Feature Plan' on // Turn off all alignments
set visibility alignment off


Select

Syntax:

Add graphical objects to the current selection.
SELECT { all | point | line | alignment | polygon | block | shape | text | image | terrain }
[ FROM { 'layer_name' | unique_layer_id } ]
[ WHERE { { 'attribute_name' | unique_attribute_id | easting | northing | height | class | area | contour | plansymbol | linestyle | blockdefinition | width | length | colour | diameter | fill | breakline | source | useinterrainmodel | units } { = | != | > | < | >= | <= } { value | default } [ and | or ] } [...n] ]

Examples:
// Select lines on layer 'Road'
select line from 'Road'
// Select points on layer 'Lot1', 'Lot2', and 'Lot3' using a wildcard.
select point from 'Lot?'
// Select points with the default height or a height less than 0.0
select point where height = default or height < 0.0
// Select points on layer 'Vegetation' with an attribute named 'Trunk' with a value greater than 0.2
select point from 'Vegetation' where 'Trunk' > 0.2
// Select polygons on layer 'Lot' with an attribute named 'Street Number' whose value is greater than 30. The attribute 'Street Number' is nested in an 'Address' attribute group.
select polygon from 'Lot' where 'Address'.'Street Number' > 30
// Select points with the coordinate class Control (Horizontal)
select point where class = hcontrol
// Select polygons with an area greater than 1000
select polygon where area > 1000
// Select polygons coloured pink
select polygon where colour = #EF75C6
// Select polygons with a hatched fill.
select polygon where fill ='H002'
// Select points with 'tree' point symbol
select point where plansymbol ='S076'
// Select points with a plan symbol length equal to 5m in ground units.
select point where length = 5
// Select points with a plan symbol width equal to 5m in ground units.
select point where width = 5
// Select points with a plan symbol coloured yellow.
select point where colour = #FFFF00
select point where colour = RGB(255,255,0)
// Select lines with a fence linestyle.
select line where linestyle ='L053'
// Select lines with a line width equal to 2m in ground units.
select line where width = 2 // Select lines coloured green.
select line where colour = #00FF00
select line where colour = RGB(0,255,0)
// Select major contour lines.
select line where contour = major
// Select points with an Easting greater that 1000.
select point where easting > 1000
// Select lines where all vertices have a northing greater than or equal to 5000.
select line where northing >= 5000
// Select polygons where all vertices are equal to 0.
select polygon where height = 0
// Select lines used as breaklines.
select line where breakline = yes
// Select polygons used as boundaries.
select polygon where breakline = boundary
// Select lines originating from an AutoCAD drawing file.
select line where source = 'c:\*.dwg'
// Select points where the units are set to Plan.
select point where units = plan.
// Select alignments that can be used in the terrain model.
select alignment where useinterrainmodel = Yes
// Select alignments that are greater than 3000m.
select alignment where length > 3000
// Select blocks that use the block definition 'Arrow'.
Select block where blockdefinition = 'Arrow'


Unselect

Syntax:

Remove graphical objects from the existing selection.
UNSELECT { all | point | line | alignment | polygon | block | shape | text | image | terrain }
[ FROM { 'layer_name' | unique_layer_id } ]
[ WHERE { { 'attribute_name' | unique_attribute_id | easting | northing | height | class | area | contour | plansymbol | linestyle | blockdefinition | width | length | colour | fill | breakline} { = | != | > | < | >= | <= } { value | default } [ and | or ] } [...n] ]

Examples:
// Unselect points with the default height or a height less than 0.0
unselect point where height = default or height < 0.0
// Unselect points on layer 'Vegetation' that have an attribute named 'Trunk' with a value greater than 0.2
unselect point from 'Vegetation' where 'Trunk' > 0.2
// Unselect points on layer 'Tree' that have an attribute named 'Species' with a value 'Spotted Gum' or 'Manna Gum'
unselect point from 'Tree' where 'Species' = '*Gum'
// Unselect polygons on layer 'Lot' with an attribute named 'Street Number' whose value is greater than 30. The attribute 'Street Number' is nested in an 'Address' attribute group.
unselect polygon from 'Lot' where 'Address'.'Street Number' > 30
// Unselect points with the coordinate class Control (Horizontal)
unselect point where class = hcontrol
// Unselect polygons with an area greater than 1000
unselect polygon where area > 1000
// Unselect polygons coloured pink
unselect polygon where colour = #EF75C6
// Unselect polygons with a hatched fill.
unselect polygon where fill = 'H002'
// Unselect points with 'tree' point symbol
unselect point where plansymbol = 'S076'
// Unselect points with a plan symbol length equal to 5m in ground units.
unselect point where length = 5
// Unselect points with a plan symbol width equal to 5m in ground units.
unselect point where width = 5
// Unselect points with a plan symbol coloured yellow.
unselect point where colour = #FFFF00
unselect point where colour = RGB(255,255,0)
// Unselect lines with a fence linestyle.
unselect line where linestyle ='L053'
// Unselect lines with a line width equal to 2m in ground units.
unselect line where width = 2 // Unselect lines coloured green.
unselect line where colour = #00FF00
unselect line where colour = RGB(0,255,0)
// Unselect major contour lines.
unselect line where contour = major
// Unselect points with an Easting greater that 1000.
unselect point where easting > 1000
// Unselect lines where all vertices have a northing greater than or equal to 5000.
unselect line where northing >= 5000
// Unselect polygons where all vertices are equal to 0.
unselect polygon where height = 0
// Unselect lines where breakline is set to 'No'.
unselect line where breakline = No
// Unselect blocks that use the block definition 'Tree'.
unselect block where blockdefinition = 'Tree'


Delete

Syntax:

Delete a layer or attribute definition from the active layer.
DELETE layer | definition { 'name' | unique_id }

Delete an attribute from the selected objects.
DELETE selected attribute { 'attribute_name' }

Delete all selected objects
DELETE selected

Example:
// Delete layer 'Vegetation'
delete layer 'Vegetation'
// Delete attribute definition 'Trunk' from the active layer
set active layer 'Vegetation'
delete definition 'Trunk'
// Select points on layer 'Road' and lines on layer 'Vegetation' then delete the objects
unselect all
select point from 'Road'
select line from 'Vegetation'
delete selected
// Delete 'Species' attribute from points with a 'Species' value of 'Pine'
select point where 'Species' = 'Pine'
delete selected attribute 'Species'
// Delete the attribute named 'Street Number' from selected polygons. The attribute 'Street Number' is nested in an 'Address' attribute group.
delete selected attribute 'Address'.'Street Number'


Insert

Syntax:

Insert a new layer
INSERT layer { 'layer_name' | unique_layer_id }

Insert a new attribute definition to the active layer
INSERT definition { 'attribute_definition_name' } { text | integer | real4 | real8 | datetime | boolean | group }

Insert a new attribute for the selected object.
INSERT selected attribute { 'attribute_name' } { value }

Insert a new attribute for the selected object using a value from another attribute or property.
(Use the Unique id property for attributes of type text.)
INSERT selected attribute {'attribute_name'} USING { attribute | property } { 'attribute_name' | uid | easting | northing | height | length | width | rotation | area | diameter } [{ + | - | * | / } {value | attribute 'attribute_name'}][...n]]

Example:
// Insert layer 'Title Boundary'.
insert layer 'Title Boundary'
// Insert attribute definition 'Width' to layer 'Road'.
set active layer 'Road'
insert definition 'Width' real4
// Insert attribute 'Width' with a value of 0.1 to lines on layer 'Road'.
select line from 'Road'
insert selected attribute 'Width' 0.1
// Insert attribute 'Species' with a value from an attribute 'Description' for all points on layer 'Vegetation'.
unselect all
select point from 'Vegetation'
insert selected attribute 'Species' using attribute 'Description'
// Insert an attribute 'Line Width' with the lines width for all lines on layer 'Fence',
unselect all
select line from 'Fence'
insert selected attribute 'Line Width' using property width
// Insert attribute 'Area' with the polygon area for all polygons.
unselect all
select polygon
insert selected attribute 'Area' using property area
// Insert a value for attribute 'Area' with the polygon area for all polygons.
unselect all
select polygon
insert selected attribute 'Area' using property area
// Insert a value for attribute 'Volume' using the polygon area multiplied by a depth of 2.
unselect all
select polygon
insert selected attribute 'Volume' using property area * 2
// Insert a value for attribute 'Diameter' using the value for the attribute 'Radius' multiplied by 2.
select all
insert selected attribute 'Diameter' using attribute 'Radius' * 2
// Select major contour lines and insert a value for attribute 'Height' using the height of vertices in the line.
select line where contour = major
insert selected attribute 'Height' using property height
// Insert an attribute definition named 'Area' nested in a 'Dimensions' group in the active layer. Then insert an 'Area' attribute for all polygons on layer 'Lot' using the 'Area' property.
Insert definition 'Dimensions' group
Insert definition 'Dimensions'.'Area' Real8
select polygon from 'Lot'
Insert selected attribute 'Dimensions'.'Area' using property area.
// Select pipes on layer 'Water' and insert an attribute 'Pipe Diam' using the diameter of the selected shapes.
select shape from 'Water''
Insert selected attribute 'Pipe Diam' using property diameter
// Select points on layer 'Sewage' and insert an attribute 'Invert'(Real8) using the height property and attribute 'Depth'(Text) and attribute 'Diameter'('Real4).
select point from 'Sewage'
update selected attribute 'Diameter' using attribute 'Diameter' / 1000
Insert selected attribute 'Invert' using property Height - attribute 'Depth' - attribute 'Diameter'/>


Update

Syntax:

Used to update layer, attribute and property values for selected objects.

Update a property for the selected objects.
UPDATE selected { easting | northing | height | class | length | width | diameter | plansymbol | linestyle | blockdefinition | colour | backgroundcolour | backgroundfill | useinterrainmodel | selected breakline | units | backgroundheightfactor | backgroundwidthfactor } { value }

Update a property for the selected objects using another property or attribute value.
UPDATE selected { easting | northing | height | length | width | diameter } USING { attribute | property } { 'attribute_name' | easting | northing | height | length | width } [ { + | - | * | /} { Value | attribute 'attribute_name'} ] [...n]]

Update the layer for the selected objects.
UPDATE selected layer { 'layer_name' | unique_layer_id }

Update an attribute value for the selected objects using a new value.
UPDATE selected attribute { 'attribute_name' } { value }

Update an attribute value for the selected objects using the value of an existing attribute or property.
(Use the Unique id property for attributes of type text. Use the remaining properties for attributes of type Real4, Real8 and Integer.)
UPDATE selected attribute { 'attribute_name' } USING { attribute | property } { 'attribute_name' | uid | easting | northing | height | length | width | rotation | area | diameter } [ { + | - | * | / } {Value | attribute 'attribute_name' } ] [...n]

Update a Text attribute value for the selected objects by adding or removing a prefix or suffix.
UPDATE selected attribute { 'attribute_name ' } { add | remove } { prefix | suffix } { value }

Update an attribute value for the selected objects by adding a numeric offset to text, integer, real4 or real8 attributes.
UPDATE selected attribute { 'attribute_name ' } { offset } { value }

Update text attributes for the selected objects by renumbering the last integer in the text string, or replacing the entire attribute value.
UPDATE selected attribute { 'attribute_name ' } { renumber } { numeric | replace } { value }

Update the height for the selected objects. The text option is valid for Text objects only.
UPDATE selected height { linear_value | default | USING { attribute | property } { 'attribute_name' | easting | northing | height | length | width } [ + | - | * | / {Value} | attribute {'attribute_name'} | USING text ]

Example:
// Move objects on layer 'Existing Road' to layer 'Road'
unselect all
select all from 'Existing Road'
update selected layer 'Road'
// Assign a pit symbol to layers on the pit layer using attribute diameter.
unselect all
select point from 'Pits'
update selected units ground
update selected plansymbol S045
update selected width using attribute 'Diameter'
update selected length using attribute 'Diameter'
// Update the Class property of points on the layer 'Control' to Control (3D).
unselect all
select point from 'Control'
update selected class control
// Move objects on layer 'Existing Road' to layer 'Road'
unselect all
select all from 'Existing Road'
update selected layer 'Road'
// Update points with an attribute 'Species" value of 'Pine' to 'Pinus'
unselect all
select point where 'Species' = 'Pine'
update selected attribute 'Species' 'Pinus'
// Update attribute 'Species' with a value from an attribute 'Description' for all points on layer 'Vegetation'
unselect all
select point from 'Vegetation'
update selected attribute 'Species' using attribute 'Description'
// Update attribute 'Diameter' using the value from attribute 'Radius' multiplied by 2, for all selected objects
update selected attribute 'Diameter' using attribute 'Radius' * 2
// Update attribute 'Name" for polygons on the easement layer with a prefix 'E'
unselect all
select polygon from 'Easement'
update selected attribute 'Name' add prefix 'E'
// Update attribute 'Description' for lines on the road layer by removing the suffix 'road'
unselect all
select line from 'Road'
update selected attribute 'Description' remove suffix road
// Update attribute 'Height' (type real4) for points on the 'Topo' layer by reducing the height by 0.2
unselect all
select point from 'Topo'
update selected attribute 'Height' offset -0.2
// Update attribute 'Name' for points on the 'default' layer by renumbering from 1000
unselect all
select point from 'Default'
update selected attribute 'Name' renumber replace 1000
// Update property Height for selected points by adding the value for the attribute 'Invert Level'.
update selected Height using property height + attribute 'Invert Level'
// Update attribute 'Road Width' by subtracting the attribute 'Kerb Width'.
update selected attribute 'Road Width' using attribute 'Road Width' - attribute 'Kerb Width'
// Update property width by applying a conversion factor defined in a text attribute 'Scale'.
update selected Width using property Width * attribute 'Scale'
// Update points with the default height to -9999.9999
unselect all
select point where height = default
update selected height -9999.9999
// Update points with a height value less than 0.0 to have the default height
unselect all
select point where height < 0.0
update selected height default
// Update the height of points to use a value from an attribute 'Ortho_Height'
unselect all
select point where height = default
update selected height using attribute 'Ortho_Height'
// Update the height of points by 50 metres using a numerical computation
update selected height using property height + 50
// Update the Easting property of the selected points by 334000.
update selected easting using property easting + 334000.
// Update the Easting property of the selected points by 334000.
// Update the Easting property of the selected points by 334000.
update selected easting using property easting + 334000.
update selected easting using property easting + 334000.
// Update the width property of the selected points symbols using the length property.
update selected width using property length.
// Double the length property of the selected points symbols.
update selected length using property length * 2.
// Update the attribute of a point with the symbol width
update selected attribute 'drain width' using property width
// Update the attribute of an alignment with the alignment length
update selected attribute 'length' using property length
// Update the colour of all polygon fill and edges using a hex colour value.
unselect all
select polygon
update selected colour #4CB4FF
// Update the colour of the selected polygons fill and edges using an RGB (Red,Green,Blue) value.
update selected colour rgb(76,180,255)
// Update the colour of all polygon fill and edges to use the colour defined by the layer.
unselect all
select polygon
update selected colour layer
// Update all points on 'traverse' layer to use the traverse symbol
unselect all
select point from 'traverse'
update selected plansymbol S020
// Update the selected lines to use a traverse linestyle.
select line from 'traverse'
update selected linestyle 'L094'
// Update the fill for all polygon to none
unselect all
select polygon
update selected fill none
// Update the background colour to orange for all text
unselect all
select text
update selected backgroundcolour #FF7F00
// For selected text, turn background text on and set the background size to be 10% larger than the text.
update selected background on
update selected backgroundwidthfactor 1.1
update selected backgroundheightfactor 1.1
// Update the lines and polygons that are not already a breakline or boundary to be breaklines.
unselect all
select polygon where breakline = no
select line where breakline = no
update breakline yes
// Update the value for attribute 'Area' for all polygons on layer 'Lot' using the 'Area' property. The 'Area' attribute definition is nested in a 'Dimensions' group in the 'Lot' layer.
select polygon from 'Lot'
update selected attribute 'Dimensions'.'Area' using property area.
// Update the value for the property 'Diameter' for all selected shapes.
update selected diameter 0.5
// Update the value for the attribute 'Pipe Radius' for all selected shapes using the pipes Diameter property.
update selected attribute 'Pipe Radius' using property diameter 0.5
// Update the value for the height property by adding the value for the attribute 'invert level', then set the invert level to 0.000.
update selected height using property height + attribute 'Invert Level'
update selected attribute 'Invert Level' 0.000
// Update the value for the property 'Use in Terrain Model' for all selected objects to use the layer settings.
update selected useinterrainmodel layer
// Update text units to ground.
select text where units = plan.
Update selected units ground.
// Update the block to use the block definition 'Tree'.
update selected blockdefinition 'Tree'


Notes
  • Values for text items that contain spaces or periods must be enclosed in single quotes.
  • Attribute, layer, line style, point symbol, fill and block definition names must be enclosed in single quotes.
  • The value for datetime must be in 'yyyy-mm-dd hh:mm:ss' format. The following special values can also be used: now (current date and time), curdate (current date), curtime (current date and current time).
  • The value for boolean must be either 'true' or 'false'.
  • The value for height, length and width is assumed to be in the currently configured linear unit for the project.
  • The value for area is assumed to be in the currently configured area unit for the project.
  • The value for colour must be either Hex value,'rgb(value,value,value)' or 'layer'.
  • The value for plansymbol must be either 'layer', 'none' or 'value'.
  • The value for linestyle must be either 'layer', 'none' or 'value'.
  • The value for fill must be either 'layer', 'solid', 'none' or 'value'.
  • The value for class must be either 'unknown','navigated', 'measured', 'averaged', 'adjusted', 'reference', 'control', 'hcontrol' or 'vcontrol'.
  • The value for contour must be either 'major','minor' or 'none'.
  • The value for breakline must be either 'yes', 'no' or 'boundary'. Boundary is applicable for polygons only.
  • The value for colour and backgroundcolour must be either hex value, 'rgb(value,value,value)' or 'Layer'
  • The value for background must be either 'on', 'off', 'projectbackground' or 'layer'.
  • The value for useinterrainmodel must be either 'yes', 'no' or 'layer'.
  • The value for units must be either 'ground' or 'plan'.
  • The value for backgroundheightfactor and backgroundwidthfactor must be a real number.
  • When inserting or updating attribute values using numeric properties the attribute type must be either real4, real8, integer or text.
  • When performing mathematical operations on attributes the attribute type must be either real4, real8, integer or text.
  • When inserting or updating a property or attribute using a mathematical operation on a property, the property must be first. You can perform a mathematical operation using one property only.
  • Numeric attribute or property values used to update integer or text attributes, will be converted to match the type of the attribute or property being updated after mathematical operations.
  • Updating or inserting an attribute defined as type Real4 or Integer with a point, line or polygon property or an attribute defined as type Real8 could result in a loss of precision.
  • Offset values for text attributes must be integers. For other attribute types the offset value must match the value type of the attribute.
  • If the attribute being offset is text the last numeric digits are offset. Numeric digits will be added to the end of the attribute if a numeric value is not found. Numeric values in text attributes must always be positive.
  • When renumbering with the numeric mode, the last integer in the text attribute is renumbered.
  • When renumbering with the replace mode, the entire text attribute is replaced.
  • The renumber start value must be between 1 and 1000000. When more than one object is selected, the attribute value increments by one each time an attribute is updated.
  • Current units will be used when inserting or updating an attribute.
  • Ground units are used when inserting, updating or selecting a plan symbol property or updating an attribute with a plan symbol property. Plan symbols with Units set to Plan are not updated.
  • Ground units are used when selecting lines with a specific width.
  • Inserting or updating an attribute using the rotation property is precise to the nearest minute.
  • Trailing zeros are removed when displaying attributes.
  • Text must be a real number in the current locale settings to be used to update the height of a text object.
  • When performing a numerical operation on an attribute value for the purpose of inserting the value into another attribute value, the types of both attributes must be the same (Real 4 and Real 8 Types are compatible however a loss of precision may occur.).
  • Numerical operations will not be performed on a default height.
  • For graphical types with more than one colour (polygons, terrain models and shapes), all displayed components are considered. If a polygons edges and fill are displayed then both the edge and fill colour must match.
  • When inserting an attribute value to a line or polygon using the height property, all vertices must share the same height.
  • Type an attribute name nested in a group using the format 'Attribute Group Name'.'Attribute Name'.
  • Updates to the length and width properties applies to the appearance properties.
  • Length refers to the length of a line for alignments or lines and the length of point symbols for points.
  • Updates to the easting and northing properties applies to selected points only.
  • Use wildcards with the From clause to select or unselect from multiple layers. Use wildcards with the Where clause to select or unselect objects with text attributes which have different values but with some identical text. Wildcard '*' denotes multiple characters can replace the '*'. Wildcard '?' denotes a single character can replace the '?'.
Related topics

Top of page TOP OF PAGE