Query Spatial Data Batch Flow

This procedure describes how to create a subflow that determines if a polygon contains a set of points using the Query Spatial Data stage. This example iterates on polygons (read one polygon at a time using Read Spatial Data and search against the point table using Query Spatial Data (MI_Contains or MI_Intersects operation)) when you have more points than polygons in your data.

Note: For more information using Enterprise Designer, see the Dataflow Designer Guide or the help inside the Enterprise Designer.

To create the batch Query Spatial Data subflow:

  1. In Enterprise Designer, choose New > Dataflow > Subflow from the File menu or New > Subflow from the Task pane.
  2. From the Palette, drag a Read Spatial Data stage onto the design canvas.
  3. Double-click on the Read Spatial Data stage to display the Options dialog. In the General tab, enter your MISQL expression to read the polygons. In the example, a basic select statement is shown: SELECT obj FROM "/PolygonTable" (where PolygonTable is the resource for your polygons in the repository). Click OK.
  4. From the Palette, drag the Query Spatial Data stage onto the design canvas to the right of the Read Spatial Data stage. Click the solid black triangle on the right side of the Read Spatial Data stage (the output port) and drag it to the left side of the Query Spatial Data stage to create a channel.
  5. Double-click on the Query Spatial Data stage to display the Options dialog. Create the contains MISQL statement in the box provided and click Verify.

    The MISQL statement should read your point table and determine if any of the polygons contain those points. For example:

    SELECT * FROM "/PointTable" WHERE MI_Contains(${Obj}, obj)
  6. Click on the Runtime... button on the Query Spatial Data stage and set it to the number of cores on the machine. Similarly, the spatial remote component pool size should be set to the same value. For more information on how to set the pool size, see Managing Memory and Threading.
  7. Drag an Output sink onto the canvas. Connect the output port of the Query Spatial Data stage to the input port of the Output sink.
  8. Double-click on the Output sink and check the field you wish to expose. Click OK.
  9. Save the subflow. To expose the subflow for use in a dataflow, choose File Expose/Unexpose and Save or click the Expose/Unexpose and Save button. The subflow displays in the User-Defined Stages folder.