Spatial Operations

Components to compute operations and measures on geometries/geographies, or to alter geometry/geography size or shape.

Distance Matrix

Description

This component creates a new table with a distance matrix computed for the geometries contained in an input table.

The output table contains three columns: 'id1', 'id2' and 'distance'.

Inputs

  • Source table [Table]

  • Geo column [Column]

  • Id column [Column]

Outputs

  • Result table [Table]

Distance (single table)

Description

This component calculates the ellipsoidal direct point-to-point, point-to-edge, or the drive distance between two sets of spatial objects.

There are three types of distance calculation relationships available:

  1. Point-to-point: The Distance tool calculates the distance between two sets of point type spatial objects. An example is calculating the distance from records in a customer data table (point type) to records in a store data table (point type).

  2. Point-to-edge (line): The Distance tool calculates the distance between a set of point type spatial objects and the closest edge of a set of line type spatial objects. An example is calculating the distance from the records in a customer data table (point type) to the nearest interstate highway (edge of line spatial type).

  3. Point-to-edge (polygon): The Distance tool calculates the distance between a set of point type spatial objects and the closest edge of a set of polygon type spatial objects.

    • When the points are contained within the polygons, you can choose one of two options: Return a distance of zero, or Return the distance to the nearest edge. If the point is located inside of a polygon the DISTANCE component returns a negative number for the distance to the edge of the containing polygon.

    • When the points are contained outside of the polygons, you can also choose to have the DISTANCE component calculate the Nearest Interior point within the nearest edge of a polygon.

    • While this method of calculating distance takes the curvature of the Earth into consideration, it is not a routing routine and does not follow street patterns or honor physical barriers such as bodies of water.

Inputs

  • Source table [Table]

  • Point or centroid source [Column]

  • Point, line or polygon destination [Column]

  • When a point is inside a polygon [Selection]

  • Create nearest interior point inside of the polygon [Boolean]

  • Output direction in degrees [Boolean]

  • Output cardinal direction [Boolean]

  • Units [Selection]

Outputs

  • Result table [Table]

Distance to Nearest

Description

This component identifies the shortest distance between spatial objects in one table and the objects in a second table.

There are many use cases for this component. For example, to find the closest store locations to consumers in the customer file (both point tables), identify the closest cell towers (point tables) to LATAs (polygon tables), or select congressional districts (polygon tables) within 50 miles of a major thoroughfare (line table).

Inputs

  • Targets [Table]

  • Universe [Table]

  • Target Spatial Object Field [Column]

  • Universe Spatial Object Field [Column]

  • Id column in target table [Column]

  • Id column in universe table [Column]

  • Maximum Distance [Number]

  • Units [Selection]

Outputs

  • Result table [Table]

Prepare for Visualization

Description

This component generates a new table that is ready to be visualized with the CARTO Maps API. Learn more abou this in Performance Considerations section.

Inputs

  • Source table

Settings

  • Geo column: Select a column that contains WKT or WKB geometries.

Outputs

  • Output table: This component returns a table with the same schema as the input one, plus additional columns describing the feature bounding box; the geometry column as WKB binaries and clustered by the boundbinx columns. Learn more.

Spatial Info

Description

This component extracts tabular information about the spatial object. Attributes like area, spatial object, number of parts, number of points, and centroid Latitude /Longitude coordinates can be revealed.

Inputs

  • Source table [Table]

  • Spatial Object Field [Column]

  • Area (Square Kilometers) [Boolean]

  • Area (Square Miles) [Boolean]

  • Bounding Rectangle as Points [Boolean]

  • Bounding Rectangle as Polygon [Boolean]

  • Bounding Rectangle as X and Y Fields [Boolean]

  • Centroid as Spatial Object [Boolean]

  • Centroid as X and Y Fields [Boolean]

  • End Points as Spatial Object [Boolean]

  • End Points as X and Y Fields [Boolean]

  • Length (Kilometers) [Boolean]

  • Length (Miles) [Boolean]

  • Number of Parts [Boolean]

  • Number of Points [Boolean]

  • Spatial Object Type [Boolean]

Outputs

  • Result table [Table]

ST Area

Description

This component creates a new table with an additional column containing the area of the geographies in the input table. This only applies to the case of polygon geographies. For other geography types, the value will be zero.

Inputs

  • Source polygons table [Table]

  • Geo column [Column]

Outputs

  • Result table [Table]

External links

BigQuery reference

Snowflake reference

Redshift reference

PostgreSQL reference

ST Buffer

Description

This component adds a new column with a buffer of the original input geography.

Inputs

  • Source table [Table]

  • Geo column [Column]

  • Distance [Number]

Outputs

  • Result table [Table]

External links

BigQuery reference

Redshift reference

PostgreSQL reference

ST Centroid

Description

This component creates a new table with a new column containing points representing the centroids of the original input geographies.

Inputs

  • Source table [Table]

  • Geo column [Column]

Outputs

  • Result table [Table]

External links

BigQuery reference

Snowflake reference

Redshift reference

PostgreSQL reference

ST Concave Hull

This component requires the CARTO Analytics Toolbox installed in the chosen connection to build the workflow.

Description

This component creates a new table containing a single row with the concave hull of geographies in the input table. The concave hull is stored in a column named 'geo'.

Inputs

  • Source table [Table]

  • Geo column [Column]

  • Max edge (km) [Number]

Outputs

  • Result table [Table]

External links

BigQuery reference

Snowflake reference

ST Convex Hull

Description

This component creates a new table containing a single row with the convex hull of geographies in the input table. The convex hull is stored in a column named 'geo'.

Inputs

  • Source table [Table]

  • Geo column [Column]

Outputs

  • Result table [Table]

External links

BigQuery reference

Redshift reference

PostgreSQL reference

ST Distance

Description

This component calculates the minimum distance between geographies of an input table and those of a second table.

It adds two new columns: 'nearest_id' and 'nearest_distance'.

Inputs

  • Main table [Table]

  • Secondary table [Table]

  • Geo column in main table [Column]

  • Geo column in secondary table [Column]

  • Id column in main table [Column]

  • Id column in secondary table [Column]

  • Radius [Number]

Outputs

  • Result table [Table]

External links

BigQuery reference

Snowflake reference

Redshift reference

PostgreSQL reference

ST DWithin

Description

This component calculates if geographies, of an input table and those of a second table that match a given criteria to join them, are within a given distance.

Inputs

  1. Source table

  2. Source table

Settings

  • Geo column in main table

  • Geo colum in second table

  • Column in main table for joining

  • Column in second table for joining

  • Max distance

Outputs

  • Output table

ST Length

Description

This component creates a new table with an additional 'length' column containing the length of the lines in the input table.

Inputs

  • Source lines table [Table]

  • Geo column [Column]

Outputs

  • Result table [Table]

External links

BigQuery reference

Snowflake reference

Redshift reference

PostgreSQL reference

ST Line Interpolate Point

This component requires the CARTO Analytics Toolbox installed in the chosen connection to build the workflow.

Description

This component takes a table and columns containing lines and distances. It adds a new column with points along the lines, at a specified distance from the start of each line.

Inputs

  • Source table [Table]

  • Lines column [Column]

  • Distance [Number]

Outputs

  • Result table [Table]

External links

BigQuery reference

Snowflake reference

Redshift reference

PostgreSQL reference

ST Perimeter

Description

This component adds a new column containing the perimeter of the geographies in the input table. This only applies to the case of polygon geographies. For other geography types, the value will be zero.

Inputs

  • Source polygons table [Table]

  • Geo column [Column]

Outputs

  • Result table [Table]

External links

BigQuery reference

Snowflake reference

Redshift reference

PostgreSQL reference

ST Simplify

Description

This component adds a new column containing a simplified version of the original input geography.

Inputs

  • Source table [Table]

  • Geo column [Column]

  • Tolerance [Number]

Outputs

  • Result table [Table]

External links

BigQuery reference

Snowflake reference

Redshift reference

PostgreSQL reference

ST Snap to Grid

Description

This component takes an input table and creates a new one replacing its geo column by a new column containing the original input geography snapped to a grid a specified size (in degrees).

Arbitrary grid sizes are not supported. The grid_size parameter is rounded so that it is of the form 10^n, where -10 < n < 0.

Inputs

  • Source table [Table]

  • Geo column [Column]

  • Grid size (degrees) [Number]

Outputs

  • Result table [Table

External links

BigQuery reference

PostgreSQL reference

Subdivide

Description

This component subdivided large features into smaller ones, using a quadgrid. It returns multiple rows, each with a smaller portion of the input feature and the rest of columns.

Inputs

  • Source table [Table]

  • Geo column [column]

  • Size: The size is the approximate length, in meters, of the cell's side used for the subdivision.

Trade Areas

Description

This component creates regions around specified point objects in the input table.

Inputs

  • Source table [Table]

  • Spatial Object Field of Point Source [Column]

  • Radius, Doughnuts [String]

  • Units [Selection]

  • Include Point in Output [Boolean]

  • Eliminate Overlap [Boolean]

Outputs

  • Result table [Table]

Last updated