Skip to content

Spatial Join

Spatial Join⚓︎

This page explains how to use the Spatial Join job to perform a spatial join operation between two datasets.


Function⚓︎

Performs a spatial join operation between two datasets within the TDEI system. It involves two datasets - target and source - specifying the spatial dimension entities of each to be joined (e.g., edge, node, zone, point, line, polygon). The join operation is guided by specified conditions that define how the geometries of the two datasets interact, typically involving spatial functions like intersections. Filters can be applied to both datasets to refine the data involved in the join. Aggregate functions are also defined to associate attributes from the source to the target dataset entity. The geometry columns for data elements are referenced as geometry_target and geometry_source.

Example: Find all light poles in a source dataset within 5 m of an edge in a target dataset, and associate the highway attribute from the source dataset with each edge.


Job Creation Form⚓︎

Spatial Join form Spatial Join form

The form contains a JSON text area pre-populated with the following template:

{
    "target_dataset_id": "",
    "target_dimension": "",
    "source_dataset_id": "",
    "source_dimension": "",
    "join_condition": "",
    "join_filter_target": "",
    "join_filter_source": "",
    "aggregate": []
}

A link labeled "(hint: check out the sample request here)" is available below the text area. Selecting it opens a Sample Request Body dialog with a copy button and an Assignment Method dropdown to switch between Default and Exclusive examples.


Assignment Methods⚓︎

The request body supports two assignment methods:

Default (no assignment_method field required):

{
    "target_dataset_id": "fa8e12ea-6b0c-4d3e-8b38-5b87b268e76b",
    "target_dimension": "edge",
    "source_dataset_id": "0d661b69495d47fb838862edf699fe09",
    "source_dimension": "point",
    "join_condition": "ST_Intersects(ST_Buffer(geometry_target, 5), geometry_source)",
    "join_filter_target": "highway='footway' AND footway='sidewalk'",
    "join_filter_source": "highway='street_lamp'",
    "aggregate": ["ARRAY_AGG(highway) as lamps"]
}

Exclusive (adds "assignment_method": "exclusive"):

{
    "target_dataset_id": "fa8e12ea-6b0c-4d3e-8b38-5b87b268e76b",
    "target_dimension": "edge",
    "source_dataset_id": "0d661b69495d47fb838862edf699fe09",
    "source_dimension": "point",
    "join_condition": "ST_Intersects(ST_Buffer(geometry_target, 5), geometry_source)",
    "join_filter_target": "highway='footway' AND footway='sidewalk'",
    "join_filter_source": "highway='street_lamp'",
    "aggregate": ["ARRAY_AGG(highway) as lamps"],
    "assignment_method": "exclusive"
}
Full job description

Performs a spatial join operation between two datasets within the TDEI system.

It involves two datasets, target and source, specifying the spatial dimension entities of each to be joined, such as edges, nodes, zones, points, lines, or polygons.

The join operation is guided by specified conditions that define how the geometries of the two datasets interact, typically involving spatial functions like intersections.

Additionally, filters can be applied to both datasets to refine the data involved in the join.

Aggregate functions are also defined to associate the attributes from source to target dataset entity.

The geometry column for data elements is specified as geometry_target and geometry_source.

Eg: Find all light poles in source dataset within 5 m of an edge in target dataset, and associate the attribute highway from source dataset with each edge in target dataset.

The response includes a job_id for tracking the request.

To check the request status, refer to the location header in the response, which provides the URL for the status API endpoint.

Select Create to submit the job. Select Cancel to return to the Jobs list.


Return to Jobs.