Build spatial SQLs in InfoAsset Manager

Build an SQL query using a spatial search type.


Build spatial SQLs in InfoAsset Manager

Step-by-step guide

When building an SQL query in InfoAsset Manager, users can employ spatial searches using the SPATIAL keyword; or between any two network layers; or between a network layer and a background network layer or GIS layer.

The following spatial search types are available:

  • Cross: for objects which intersect a layer line or polygon area.
  • Inside: for objects inside a layer polygon.
  • Contains: for polygons with layer objects inside the polygon.
  • Distance: for objects within a search distance of a layer, line, or polygon area.
  • Nearest: for the nearest object within a specified distance. If there is more than one object within the specified distance, the first one found is returned as the result.

The InfoAsset Manager interface, with the GeoPlan active in the background for the desired network, and with the SQL dialog box open in front and the Spatial Search drop-down open to show the Object Type options.

In this example, the ground water pollution risk for a pipe needs to be set based on the risk value of the GIS background layer. The network is open on the GeoPlan with the needed Soils GIS background layer loaded.

  1. From the Selection toolbar, click SQL Select.
    The top-left corner of the InfoAsset Manager interface, with the SQL Select tool highlighted in blue as it is being clicked.
  2. In the SQL dialog, switch to the SQL tab.
  3. Set the Object type to All Links.
  4. In the text box, start typing the query as follows:

SET ground_water_risk = 5 WHERE

  1. Add a space to the end of the query.
  2. From the Spatial Search group, set the Search Type to Cross.
  3. Set the Layer Type to GIS Layer.
  4. Set the Layer to [TAB] Soils.
  5. Set the Field drop-down to spatial.RISK_2.
  6. Complete the syntax to set a ground water risk of 5 WHERE the spatial value is ‘High risk’ and where the current risk value is lower than the spatial risk value or is null.

The query now reads as follows:

SET ground_water_risk = 5 WHERE spatial.RISK_2='High risk' AND (ground_water_risk < 5 OR ground_water_risk = NULL)

  1. Build upon this query to add a ground water risk of 3 for ‘Medium’ and 1 for ‘Low’.

The full query is as follows:

SET ground_water_risk = 5 WHERE spatial.RISK_2='High risk' AND (ground_water_risk < 5 OR ground_water_risk = NULL);

SET ground_water_risk = 3 WHERE spatial.RISK_2='Medium' AND (ground_water_risk < 3 OR ground_water_risk = NULL);

SET ground_water_risk = 1 WHERE spatial.RISK_2='Low' AND (ground_water_risk < 1 OR ground_water_risk = NULL)

  1. Click Test to validate the query.
  2. In the message popup, click OK.
  3. To save the query for later use, click Save As.
  4. To run the query, click Run.
  5. From the Asset Grid Windows toolbar, click New asset window.
    The top-left corner of the InfoAsset Manager interface, with the GeoPlan active and the New assets window tool being selected from the Asset Grid Windows toolbar.
  6. Switch to the Pipe tab.
  7. Locate the Ground water pollution risk column, where there are now values of 5, 3, and 1 for high, medium, and low risk.
    The New assets window open to the Pipe tab, with the Ground water pollution risk column showing values of 5, 3, and 1 for high, medium, and low risk.