Skip to main content
Skip table of contents

Spatial Join2 and Spatial Join

The Spatial Join tool has been replaced by the Spatial Join2 tool. Existing projects containing the Spatial Join tool will continue to work. However, you can obtain better performance by using the newer Spatial Join2 tool instead.

Spatial Join2

The Spatial Join2 tool finds relationships between two sets of shapes. This is useful for solving problems such as the following.

Finding a location within boundaries

Suppose that you have two input tables:

  • A consumer table containing the coordinates (latitude and longitude) of the address of each person.

  • A set of polygon data for the boundaries of every county in the United States.

Using the Spatial Join2 tool, you can find the county each consumer lives in by connecting the consumers to the right input, the county shapes to the left inputs, and choosing the left contains right relationship type.

Finding overlap and collisions

You might have one set of polygons representing property boundaries, and another set of polygons representing 100-year-flood boundaries. You can determine which properties lie at least partly within the 100-year floodplain by connecting the properties to the left input, the flood boundaries to the right input, and selecting both left and right intersect and left contained by right relationship types.

Performing a market area analysis

Suppose that you have the following two tables:

  • A consumer table containing the coordinates (latitude and longitude) of the address of each person.

  • A set of latitude/longitude locations for retail outlets.

Using the Make Circle function, you can create circles around each retail outlet representing the area within a fixed distance. By joining the resulting circles against the consumer location points, you can find all consumers that fall within a given distance of each store. From there, you can analyze things like cannibalization rates (consumers within distance of two or more stores), market coverage (percentage of consumers not within a given distance of any store), and performance ratios (store revenue vs. covered population). Generally, when looking for points within polygons, you should connect the points (consumers in this case) to the right side of the join, and connect the polygons (the circles) to the left side, and then select the left contains right relationship type.

The Spatial Join2 tool accepts two inputs, Left and Right, both of which must contain a field of type Spatial. The Spatial Join2 tool determines which pairs of shapes from the left and right sides satisfy the relationship condition, which may be any combination of the following:

  • Left and right shapes intersect

  • Left shape contains right shape

  • Left shape contained by right shape

The Spatial Join tool produces a single output combining left and right records that satisfy the relation condition. The number of output records for each left input may be limited by selecting Limit join results per left record and specifying a limit. You may also optionally output a record for each left record that joins to no right records, in which case the right values will be set to null. Finally, you can select and rename the output fields in a manner similar to the Join tool.

  • If the Left and Right inputs have field names in common, use the output select/rename grid to avoid name collisions.

  • If your records have U.S. street addresses but no latitude and longitude, you can create these using Data Management's Geocoder tool, or a third-party Geocoder tool.

  • If you want to do point-in-polygon processing, attach the input containing points on the right side and the input containing polygons on the left side for best performance.

  • If you want to join only shapes where another data value also matches (for example, STATE), select Use segmentation and specify the Left and Right segment fields.

  • You can input shape data in TAB, MID/MIF, and Shapefile formats using the Spatial Input tool.

  • You can use the functions MakeRect and MakeCircle to synthesize polygons.

  • You can use the Spatial Process tool to perform point-wise composition and decomposition on shapes.

Spatial Join2 tool configuration parameters

The Spatial Join tool has a single set of configuration parameters in addition to the standard execution options.

Parameter

Description

Left spatial field

The field containing shapes on the left input.

Right spatial field

The field containing shapes on the right input.

Left and right shapes intersect

If selected, outputs records in which the left and right shapes intersect (at least one left/right pairs of line segments cross).

Left shape contains right shape

If selected, outputs records in which the left shape completely contains the right shape (intersecting shapes do not count).

Left shape contained by right shape

If selected, outputs records in which the left shape is completely contained by the right shape (intersecting shapes do not count).

Limit join results per left record

If selected, the number of records output for each left input record is limited.

Max results per shape

If Limit join results per left record is selected, specifies the record limit.

Output empty non-joining left field

If selected, outputs a record with null right-side values for each non-joining left record.

Use segmentation

If selected, allows specification of a segment field on the left and right inputs, and joins only records whose segment fields match in addition to satisfying the spatial relationship.

Left segment field

If Use segmentation is selected, the left input field that must match in addition to the spatial relation.

Right segment field

If Use segmentation is selected, the right input field that must match in addition to the spatial relation.

Join output

List of fields to be included in output. You can Select them individually, or choose from Select all, Select none, Select non-conflicting, Rename conflicting, or Remove non-existent.

All fields in the output record must have unique names.

Automatically select new fields

If selected, any upstream field that is not specified in Rename fields will be selected automatically on output.

Configure the Spatial Join2 tool

  1. Select the Spatial Join2 tool.

  2. Go to the Input tab.

  3. Select the Left spatial field containing the shapes you want to compare with shapes on the right input.

  4. Select the Right spatial field containing the shapes you want to compare with shapes on the left input.

  5. Select one or more spatial relationships:

    • Left and right shapes intersect

    • Left shape contains right shape

    • Left shape is contained by right shape

  6. Optionally, select Limit join results per left record and enter a limit of Max results per shape. This arbitrarily excludes right records that exceed the limit on a per-left-record basis.

  7. Optionally, select Output empty non-joining left record to output a record for each left record that joins to no right records. The right record values will be set to null.

  8. Optionally, select Use Segmentation and specify a Left and Right segment field. This limits joins to those left/right record pairs in which the segment fields match.

  9. Optionally, choose the fields you wish to output: select them individually, or select Join output to choose from:

    • Select all

    • Select none

    • Select non-conflicting

    • Rename conflicting

    • Remove non-existent

  10. Clear the spatial fields from output unless you need them; this will improve performance as shape data is often large.

  11. Optionally, go to the Execution tab, and then set Web service options.

Spatial Join

The Spatial Join tool has been replaced by the Spatial Join2 tool. Existing projects containing the Spatial Join tool will continue to work. However, you can obtain better performance by using the newer Spatial Join2 tool instead.

The Spatial Join tool helps you locate a point within one of a set of polygons. For example, you might have input data with coordinates (latitude and longitude) for each record, and polygon data for every county in the United States. Using the Spatial Join tool, you can find which county each record falls within.

The Spatial Join tool accepts two inputs:

  • A Data input (D), which must be a Spatial field containing points.

  • The Spatial (S) input, which must be a Spatial field containing polygons.

For each record on the Data input, the Spatial Join tool looks at the point value and attempts to find a corresponding record in the Polygon input whose polygon contains the point. If a matching polygon record is found, it is appended to the Data input record and sent to the output table. If no matching polygon record is found, the Data record is appended with Null fields matching the schema of the polygon record.

The Spatial Join tool produces a single table with one record for each Data input record. The schema of the output table is formed by appending the Data and Polygon records into one wide record.

  • If the Data and Polygon inputs have field names in common, you must rename or eliminate some fields to avoid a name collision.

  • If your records have U.S. street addresses but no latitude and longitude, you can create these using Data Management's Geocoder, or a third-party Geocoder tool.

  • If the Polygon input has several polygons containing a point (overlapping polygons), a single polygon record will be arbitrarily chosen.

Spatial Join tool configuration parameters

The Spatial Join tool has been replaced by the Spatial Join2 tool. Existing projects containing the Spatial Join tool will continue to work. However, you can obtain better performance by using the newer Spatial Join2 tool instead.

The Spatial Join tool has a single set of configuration parameters in addition to the standard execution options.

Parameter

Description

Data (points) field

The points you want to locate within the Polygon input records from the Data (D) input records.

Spatial (polygons) field

The field containing polygons from the Spatial (S) input records.

Include spatial polygons in output

If selected, spatial polygons will be included in the output.

Polygons per point

If Include spatial polygons in output is selected, you can specify how many polygons per point to include.

Output non-joining record

If selected, includes records with null spatial values when no polygons join.

Keep data order

If selected, keeps the original order of the Data input.

Use segmentation

If selected, you can specify fields on the Data and Spatial inputs that must match in addition to the point in polygon.

Data segment field

If Use segmentation is selected, the Data input field that must match in addition to the point in polygon.

Spatial segment field

If Use segmentation is selected, the Spatial input field that must match in addition to the point in polygon.

Configure the Spatial Join tool

The Spatial Join tool has been replaced by the Spatial Join2 tool. Existing projects containing the Spatial Join tool will continue to work. However, you can obtain better performance by using the newer Spatial Join2 tool instead.

  1. Select the Spatial Join tool.

  2. Go to the Input tab.

  3. Select the Data (points) field containing the points you want to locate within the Polygon input records from the Data (D) input records.

  4. Select the Spatial (polygon) field that contains polygons from the Spatial (S) input records.

  5. Optionally, select Include spatial polygon in output and specify how many Polygons per point to include in the output records. Unless you need the actual polygon data, you should leave this cleared because polygons can be large.

  6. Optionally, select Output empty non-joining record to include records with null spatial values when no polygons join.

  7. Optionally, select Keep data order to keep the original order of the Data input.

  8. Optionally, select Use Segmentation and specify a Data segment field and a Spatial segment field. These are fields on the Data and Spatial inputs that must match in addition to the point in polygon. Specifying these fields can dramatically speed up operations for data with a natural segment (such as State).

  9. Optionally, go to the Execution tab, and then set Web service options.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.