Spatial Match Icon

Spatial Match Tool

Version:
2022.3
Last modified: January 06, 2023

One Tool Example

Spatial Match has a One Tool Example. Visit Sample Workflows to learn how to access this and many other examples directly in Alteryx Designer.

Use Spatial Match to establish the spatial relationship (contains, intersects, touches, etc.) between two sets of spatial objects. The tool accepts a set of spatial objects from the Target Input and a set of spatial objects from the Universe Input. At least one input stream should contain Polygon type spatial objects.

For more information on the Spatial Match tool, visit Spatial Match Behavior.

Connect Inputs

A Universe (U) input connection into this tool is optional (this file can be specified via an input path ), as indicated by the white input connection arrow.

For each record from the Target’s data stream, the Spatial Match tool analyzes the spatial object’s extents and attempts to find a record in the Universe’s data stream whose spatial object’s extents intersect with that of the Target's. If a matching record is found in the Universe Input, it is sent through the Matched output, and joined to the Target record. If no matching Universe Input record is found, the Target record is sent through the Unmatched output.

Configure the Tool

The Spatial Match tool accepts 2 spatial inputs.

  1. Select the Targets (T Input) Spatial object. When working with polygons on both sides, the physically larger polygons should be on the Targets side. When working with polygons and points, the polygon should be on the Targets side.
  2. Specify the Universe object:
    • Use Records from U Input: Select the Spatial Object field from the data going into the tool.
    • Use Records from File or Database: When reading in spatial objects from a data source, make sure the data source that is being brought in has already been sorted on the spatial object. Ensure no connection is going to the U input.
      • To specify the input data source, either enter the file path location of the input or use the associated dropdown to navigate to the data source's location.
      • Select the Spatial Object field from the input data source to match against. The physically smaller objects should be on the Universe side. Specifying a YXDB for direct import is a more efficient vehicle for running a Spatial Match. In fact, it's good practice to convert any static polygon file (such as basic geographies: States, Counties, etc.) to a pre-sorted YXDB. Go to Troubleshooting/FAQ for more information.

        Calgary Spatial Matches

        If specifying a Calgary CYDB) file, be aware that the Calgary spatial index uses 5 decimal places of accuracy for compression and speed.  The YXDB spatial index uses 6 decimal places. This adds an addition round-off error of up to a maximum of 1.8 feet to Calgary indexes. In other words, it is possible that a point can be 1.8 feet inside of a polygon and be found as outside the polygon in Calgary.

  3. Specify the type of Spatial Match to calculate:
    • Where Target Intersects Universe: Matches records where both sets of objects have any area in common.

      Shows visualization of Where Target Intersects Universe option
    • Where Target Contains Universe: Matches records where Target objects contain Universe objects in their entirety.

      Shows visualization of Where Target Contains Universe option
    • Where Target Within Universe: Matches records where Target objects are entirely within Universe objects.

      Shows visualization of Where Target Is Within Universe option
      ​​​
    • Where Target Touches Universe: Matches records where Target objects touch the outside boundary of Universe objects. To qualify as touching, neither object can occupy any of the same interior space.

      Shows visualization of Where Target Touches Universe option
      ​​​​​
    • Where Target Touches or Intersects Universe: Matches records where Target objects either share interior space with Universe objects or touch the boundary of Universe objects.

      Shows visualization of Where Target Touches Universe option or Shows visualization of Where Target Intersects Universe option
    • Where Target Bounding Rectangle Overlaps Universe: Matches records where the bounding rectangles of Target objects and Universe objects share interior space.

      Shows visualization of Bounding Rectangle Overlaps option
      ​​​
    • Custom DE-9IM Relation: Users must be familiar with DE-9IM relations to enter the custom value.
      When bringing Line type objects into the Spatial Match, matching is based on the bounding rectangle only.

      Shows visualization of Bounding Rectangle of a Line option
  4. Output Intersection Object (Intersects Only): When checked, the intersection polygon will be included in downstream tools. This option is only relevant when matching polygon to polygon.

Use the table in the Configuration window to modify the incoming data stream. Each row in the table represents a column in your data. The Field column in the table identifies the name of each column in the data and auto-sizes to fit column (field) names without cutting off any text (up to 40 characters).

Search Fields

Before you start updating your fields (columns), you might want to limit your list so that you can perform updates on only a subset of the fields. This is also really beneficial if your dataset contains many fields.

To do this, you can use the Search box at the top of the Configuration window. Enter a keyword and the Spatial Match tool searches the Field, Rename, and Description columns to return matches. The search is not case-sensitive.

Image showing the tool Configuration window with the Search box highlighted.

 

You can then perform various actions (like select, deselect, rename, etc.) on only the fields that were returned via your search. Think of the Search box as a way to filter your list of fields so that you can update only a subset of your data columns.

To view your entire list of fields again, use the "x" icon to clear out the Search box.

After you perform a search, only a subset of your data fields (columns) display. Please note that depending on what action you chose in the Options menu...

  • Some actions might apply to only fields shown.
  • Some actions might apply to all fields, regardless of which ones are shown
  • Some actions might only apply to the specific fields that are selected (highlighted) in the list of fields.

Because of this, please use caution when you perform actions on a subset of fields and double-check the results to make sure they are what you're expecting.

Select, Deselect, Sort, and Reorder Columns

Select and Deselect Fields/Columns

To include a column in the dataset, check the check box to the left of the column name. Uncheck the check box to exclude the column. You can also use the select and deselect all check box at the top of the table to quickly select and deselect all visible fields.

Image showing the tool configuration window with the select all check box highlighted.

Sort Columns

To sort the columns of data based on the column name...

  • Click on the column name to sort in ascending order.
  • Click on the column name a second time to sort in descending order.

Sort Method

Depending on the language of your Designer instance, a different default sort order might be used. Consult the Localization User Settings to read more about the default Sort Method.

Reorder Columns

To reorder the columns of data...

  • Select to highlight a row, or select and drag to highlight multiple rows.
  • Use the Move Up or Move Down arrows, or right-click and drag, to move the rows to a new location.

The Unknown column is selected by default. It allows new columns in the data. Move the column to the location where you want a new column to be.

Modify Data Type and Size

Data Type

Use the Type dropdown to change the data type of a column in your dataset.

Data Size

To change the supported length (characters for string and numeric fixed decimal types) or measurement (bytes for other numeric types) of data in a column, select Size and enter a number. Size varies by data type and you can edit it for fixed decimal numeric types and all string types.

Use the [data type]: Forced option to ensure a column always contains the expected data type. This is helpful when creating macros.

Rename a Column or Add a Description

  • To change the name of a column, select the Rename field and enter the new name.
  • To add a description, select the Description field and enter a description.

View More Options

After you select or highlight rows (columns of data) in the table, select the Options dropdown above the table to view more configuration options:

  • Save/Load: Save Field Configuration as a .yxft file. The Alteryx Field Type File is a text file that can be used in other workflows using the Load Field Names or Load Field Names & Types options.
  • Select: Select or deselect all or highlight columns. Options include Select All and Deselect All.
  • Change Field Type of Highlighted Fields: Change the data type of all highlighted columns at once.
  • Sort: Sort the column order in ascending or descending order. Options include Sort on Original Field Name, Sort on New Field Name, and Sort on Field Type, or Revert to Incoming Field Order. Depending on the language of your Designer instance, a different default sort order might be used. Consult the Localization User Settings to read more about the default Sort Method.
  • Move: Move highlighted columns to the top or bottom of the list.
  • Add Prefix to Field Names: Add a prefix to the selected or highlighted column name.
  • Add Suffix to Field Names: Add a suffix to the selected or highlighted column name.
  • Remove Prefix or Suffix: Remove the prefix or suffix from the selected or highlighted column name.
  • Clear All Renames: Remove the new name for all columns.
  • Clear Highlighted Renames: Remove the new name for all highlighted columns.
  • Revert All to Original Type & Size: Undo all changes to type and size in all columns and use the original values.
  • Revert Highlighted to Original Type & Size: Undo changes to type and size in the selected or highlighted columns and use the original values.
  • Forget All Missing Fields: Remove all columns that are no longer included in the data.
  • Forget Highlighted Missing Fields: Remove all highlighted columns that are no longer included in the data.
  • Deselect Duplicate Fields: Deselect the second column when duplicate column names exist. This option is only available with multiple inputs.

View the Output

The Spatial Match tool produces a single or double data stream with one record for each instance of a Target Input record matching a Universe Input record. The schema of the output table is formed by appending the fields from both records into one wide record.

Spatial Outputs

While using spatial tools, you might have more than one spatial object field in the data stream. When you are configuring the final output tool, you must remember that output to files such as .dbf, .xls, or .csv does not accept the spatial object fields, and that spatial files only accept one spatial object field.

Connect a Browse tool to each output anchor to view results.

  • M anchors: Matched records that come from this stream are Target records whose object has a match from the Universe stream. The Universe object and selected fields are joined to the Target Record. A Target record may come out of the matched side any number of times, depending on how many Universe objects are matched.
  • U anchors: Unmatched records that come from this stream are Target records whose object that had no match from the Universe stream.
Was This Page Helpful?

Running into problems or issues with your Alteryx product? Visit the Alteryx Community or contact support. Can't submit this form? Email us.