Point in Polygon Subflow
This procedure describes how to create a subflow using the Query Spatial Data stage to deterimine if a point is located within a given polygon.
This subflow takes as the source an x and y and creates a point geometry using Spatial Calculator's Create Point operation. The resulting geometry is the input for the Query Spatial Data stage which is then output to an output sink.
To create a point in polygon subflow:
-
In Enterprise Designer, choose
from the File menu or from the Task pane.
For more information about creating subflows, see the Dataflow Designer's Guide from the Help menu.
- Drag an Input icon onto the canvas and double-click it to display the Options dialog.
- Click the Add button to display the Add Custom field dialog. Click Add and provide the field name 'x' and the type as double. Click OK.
- Repeat Step 3 to add a field 'y' of type double. Click OK to leave the Input Options dialog.
- From the Spatial Stages section in the Palette, drag Spatial Calculator onto the design canvas. Click the solid black triangle on the right side of the Input stage (the output port) and drag it to the left side of the Spatial Calculator stage to create a channel.
- Double-click on Spatial Calculator to display the Options dialog. Choose Create Point Geometry from the list of operations. Change the coordinate system if necessary. Click OK. Rename the Spatial Calculator to Create Point so you can remember what it does.
- Drag the Query Spatial Data stage onto the canvas. Connect the output port of the Create Point operation to the input port of the Query Spatial Data stage.
-
Double-click on the Query Spatial Data stage to display the Options dialog.
Create the MISQL statement in the box provided and click
Verify.
Here is an example statement. Modify the field and named table to match your data.
select STATE from "/Samples/NamedTables/USA" where Obj contains ${Geometry}
- 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.
- Double-click on the Output sink and check the field you wish to expose. In our example, check the State field. Click OK.
-
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.
The subflow is now ready to incorporate into a Point in Polygon dataflow.