Distance Matrix

DistanceMatrixConfig — distance/duration matrix data source.

class DistanceMatrixConfig(from_sheet_name, from_longitude_column, from_latitude_column, outputs)[source]

Computes a matrix of distances/durations between origin and destination points.

Configure destinations via set_to_sheet(). By default the destination sheet is the same as the origin sheet (square matrix). Each entry in outputs defines where one metric is written.

Parameters:
  • from_sheet_name (str) – Source sheet for origin rows.

  • from_longitude_column (str) – Origin-row longitude column name.

  • from_latitude_column (str) – Origin-row latitude column name.

  • outputs (list[OutputMatrix]) – One OutputMatrix per metric to produce.

set_to_sheet(to_sheet_name, to_longitude_column, to_latitude_column)[source]

Set the destination sheet name and longitude/latitude columns.

Return type:

DistanceMatrixConfig

set_from_table_name(from_table_name)[source]

Set the structured-table name for origin rows (alternative to a sheet name).

Return type:

DistanceMatrixConfig

set_to_table_name(to_table_name)[source]

Set the structured-table name for destination rows.

Return type:

DistanceMatrixConfig

property type: DataSourceType

The DataSourceType discriminator for this configuration.

OutputMatrix and Metric for DistanceMatrixConfig outputs.

class Metric(*values)[source]

Distance-matrix output metric.

DRIVING_DISTANCE = 'DRIVING_DISTANCE'

Driving distance along the route.

DRIVING_TIME = 'DRIVING_TIME'

Driving time along the route.

class OutputMatrix(sheet_name, named_range, metric)[source]

Where one metric of a DistanceMatrixConfig is written.

Parameters:
  • sheet_name (str) – Target sheet name for the output matrix.

  • named_range (str) – Named range within the sheet receiving the values.

  • metric (Metric) – Which Metric this output records.