OriginDestinationCostMatrixResult
Summary
An object containing the results of an origin destination cost matrix analysis that can be used to access outputs and solver messages.
Discussion
Instances of this class cannot be created directly. Instead, they are returned by the solve method of the OriginDestinationCostMatrix class.
Learn more about how to use the result object to access and work with the analysis outputs
Properties
| Name | Explanation | Data type |
|---|---|---|
|
isPartialSolution (Read only) |
Returns |
Boolean |
|
solveSucceeded (Read only) |
Returns |
Boolean |
|
spatialReference (Read only) |
Returns the spatial reference of the output features. For example, feature classes created using the |
SpatialReference |
Methods
count(output_type)
Returns the number of rows for an output type.
Raises no exception.
| Name | Explanation | Data type |
|---|---|---|
|
output_type |
The type of output features to count. Set this parameter using the |
Object |
Return value
| Data type | Explanation |
|---|---|
|
Integer |
The number of rows. |
export(output_type, output_features)
Exports the analysis results to a feature class or table.
The output features will be created in the spatial reference of the network dataset used for the analysis. If the arcpy.env.outputCoordinateSystem environment is set, the output features will be created with the specified coordinate system instead.
| Name | Explanation | Data type |
|---|---|---|
|
output_type |
The type of output to export. Set this parameter using the |
Object |
|
output_features |
The catalog path to the output feature class or table that will contain the exported features. |
String |
extent({output_type})
Returns the extent of the analysis output.
The method returns a RuntimeError exception if the analysis solve failed.
| Name | Explanation | Data type |
|---|---|---|
|
output_type (Optional) |
The type of output features for which to get the extent. Set this parameter using the If you do not specify a value, or you specify a value of |
Object |
Return value
| Data type | Explanation |
|---|---|
|
Extent |
An |
fieldNames(output_type)
Returns a list of field names supported by a specified output type.
| Name | Explanation | Data type |
|---|---|---|
|
output_type |
The type of output for which to return a list of field names. Set this parameter using the |
Object |
Return value
| Data type | Explanation |
|---|---|
|
String |
A list of field names supported by the specified output type. |
saveAsLayerFile(file_name)
Save the analysis result and settings to a network analysis layer file or package. The layer file or package can be opened in ArcGIS Pro as a record of the analysis settings or to visualize the results.
The method returns a RuntimeError exception if the allowSaveLayerFile property on the solver object is set to False.
Legacy:
Routing services based on portals running versions of ArcGIS Enterprise older than 10.9 do not support saving layer packages. The method returns a RuntimeError exception if this is the case.
| Name | Explanation | Data type |
|---|---|---|
|
file_name |
The catalog path of the output layer file ( Caution:Layer files with an |
String |
searchCursor(output_type, field_names[field_names,...], {where_clause})
Establishes a search cursor on the specified output type. This cursor can be used to read rows directly from the output.
| Name | Explanation | Data type |
|---|---|---|
|
output_type |
The type of output that will be read. Set this parameter using the |
Object |
|
field_names[field_names,...] |
A list of field names of the output type whose values will be returned by the cursor. You can get the names of the fields supported by an output type using the Learn more about the fields included in each output type In addition to regular fields, you can also access the geometry of the output using one of the following geometry tokens:
The Tip:Retrieving geometry for the |
String |
|
where_clause (Optional) |
An optional expression that limits the records returned. For more information on WHERE clauses and SQL statements, see SQL reference for query expressions used in ArcGIS. The default value is None. |
String |
Return value
| Data type | Explanation |
|---|---|
|
Object |
A |
solverMessages(severity)
Get error, warning, and informational messages returned by the solver.
| Name | Explanation | Data type |
|---|---|---|
|
severity |
The type of messages to be returned. The parameter should be specified using the |
Object |
Return value
| Data type | Explanation |
|---|---|
|
List |
The messages are returned as a list of lists. The inner list contains two values; the first is a number representing the message code, and the second value is the message text. An example of a list of messages returned from a failed origin destination cost matrix analysis.
|
toArrowTable(output_type, field_names[field_names,...], {file_name}, {max_batch_size})
Returns the OD Cost Matrix result in Apache Arrow format.
Note:
Arrow output is not available if the solver object uses a service URL as its network data source. The method returns a RuntimeError exception in this case.
Learn more about how to use this method and see examples
| Name | Explanation | Data type |
|---|---|---|
|
output_type |
The type of output that will be read. Set this parameter using the Caution:Only the |
Object |
|
field_names[field_names,...] |
A list of field names of the output type to include in the Arrow table. Learn more about the fields included in each output type Caution:For the |
String |
|
file_name (Optional) |
The file path to use to save the analysis results permanently. The file will contain one or more Arrow record batches and can be opened in any package or library that supports the Arrow format. This parameter is optional. If it is not specified, the Arrow table returned by the method can be used within the current Python operation but will not be stored permanently. |
String |
|
max_batch_size (Optional) |
The maximum number of records to include in a single record batch in the output Arrow table. When no value or For very large analyses, writing the output in batches prevents out-of-memory errors. The method always returns a single Arrow table and output file (if the For the The value for |
Integer |
Return value
| Data type | Explanation |
|---|---|
|
Object |
An Apache Arrow Table Python object representing the desired output type with the specified fields. |