Resumen
An object containing the results of an origin destination cost matrix analysis that can be used to access outputs and solver messages.
Debate
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
Propiedades
Propiedad | Explicación | Tipo de datos |
isPartialSolution (Sólo lectura) | Returns True if the solver produced a partial solution, meaning that not all inputs were included in the results. This can occur if one of the inputs is unlocated and the solver class's ignoreInvalidLocations property is set to True. | Boolean |
solveSucceeded (Sólo lectura) | Returns True if the solve was successful. | Boolean |
spatialReference (Sólo lectura) | Returns the spatial reference of the output features. For example, feature classes created using the export method and geometry objects retrieved from the searchCursor method will have this spatial reference. The spatialReference value is typically the spatial reference of the network dataset or service used in the analysis. | SpatialReference |
Descripción general del método
Método | Explicación |
count (output_type) | Returns the number of rows for an output type. |
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. |
extent ({output_type}) |
Returns the extent of the analysis output. The method returns a RuntimeError exception if the analysis solve failed. |
fieldNames (output_type) | Returns a list of field names supported by a specified output type. |
saveAsLayerFile (file_name) | Save the analysis result and settings to a layer file or layer package. The layer file or package can be opened in ArcGIS Pro as a record of the analysis settings or to visualize the results. A layer file can also be opened in ArcGIS Desktop. The method returns a RuntimeError exception if the allowSaveLayerFile property on the solver object is set to False. Heredado: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. |
searchCursor (output_type, 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. |
solverMessages (severity) | Get error, warning, and informational messages returned by the solver. |
toArrowTable (output_type, field_names, {file_name}, {max_batch_size}) | Returns the OD Cost Matrix result in Apache Arrow format. Nota: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. |
Métodos
count (output_type)
Parámetro | Explicación | Tipo de datos |
output_type | The type of output features to count. Set this parameter using the OriginDestinationCostMatrixOutputDataType enumeration. | Object |
Tipo de datos | Explicación |
Integer | The number of rows. |
Raises no exception.
export (output_type, output_features)
Parámetro | Explicación | Tipo de datos |
output_type | The type of output to export. Set this parameter using the OriginDestinationCostMatrixOutputDataType enumeration. | Object |
output_features | The catalog path to the output feature class or table that will contain the exported features. | String |
extent ({output_type})
Parámetro | Explicación | Tipo de datos |
output_type | The type of output features for which to get the extent. Set this parameter using the OriginDestinationCostMatrixOutputDataType enumeration. If you do not specify a value, or you specify a value of None, the extent for the combined analysis outputs is returned. | Object |
Tipo de datos | Explicación |
Extent | An arcpy.Extent object indicating the extent of the designated output type. |
fieldNames (output_type)
Parámetro | Explicación | Tipo de datos |
output_type | The type of output for which to return a list of field names. Set this parameter using the OriginDestinationCostMatrixOutputDataType enumeration. | Object |
Tipo de datos | Explicación |
String | A list of field names supported by the specified output type. |
saveAsLayerFile (file_name)
Parámetro | Explicación | Tipo de datos |
file_name | The catalog path of the output layer file (.lyr) or layer package (.lpkx) to write. Precaución:Layer files with an .lyr extension cannot be saved if the solver object uses a service URL as its network data source. The method returns a RuntimeError exception in this case. | String |
searchCursor (output_type, field_names, {where_clause})
Parámetro | Explicación | Tipo de datos |
output_type | The type of output that will be read. Set this parameter using the OriginDestinationCostMatrixOutputDataType enumeration. | 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 that are supported by an output type using the fieldNames method. See descriptions of 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 SHAPE@XY and SHAPE@XYZ tokens are only supported for point-based output types. The x-, y-, and z-values returned when using the SHAPE@XY and SHAPE@XYZ tokens are in the spatial reference reported by the solver result object's spatialReference property, and this is typically the same as the spatial reference of the network data source used for the analysis. Sugerencia:Retrieving geometry for the Lines output type can be slow. For best performance, do not request geometry using any of the geometry tokens. | String |
where_clause | Una expresión opcional que limita los registros que se devuelven. Para obtener más información sobre cláusulas WHERE y sentencias SQL, consulte Referencia de SQL para las expresiones de consulta utilizadas en ArcGIS. (El valor predeterminado es None) | String |
Tipo de datos | Explicación |
Object | A SolverResultSearchCursor object that reads rows from the output. |
solverMessages (severity)
Parámetro | Explicación | Tipo de datos |
severity | The type of messages to be returned. The parameter should be specified using the MessageSeverity enumeration. | Object |
Tipo de datos | Explicación |
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, {file_name}, {max_batch_size})
Parámetro | Explicación | Tipo de datos |
output_type | The type of output that will be read. Set this parameter using the OriginDestinationCostMatrixOutputDataType enumeration. Precaución:Only the Lines output type is currently supported. The method returns a RuntimeError exception if a different output type is specified. | Object |
field_names [field_names,...] | A list of field names of the output type to include in the Arrow table. See descriptions of the fields included in each output type Precaución:For the Lines output type, the Shape, OriginName, and DestinationName fields are not supported. | String |
file_name | 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 | The maximum number of records to include in a single record batch in the output Arrow table. When no value or None is specified, a value of 2,147,483,647 is used. If the total number of records is smaller than the specified max_batch_size, the output Arrow table and file will contain only one record batch. 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 file_name parameter is specified), but the presence of multiple record batches in the output may influence how you handle it in subsequent code. When an Arrow table or file containing multiple record batches is converted to another format, such as a Pandas DataFrame, you may not be able to do a zero-copy read of the entire table or file. In a zero-copy read, the data can be accessed without additional serialization overhead to load it in RAM. To achieve this zero-copy read behavior, your code may need to handle one record batch at a time. For the Lines output type, for most applications, it is important to keep all records associated with the same origin together in the same batch. This ensures that you can do a zero-copy read of all records for that origin for post-processing or further analysis. If the number of records associated with a given origin exceeds the specified max_batch_size, the method will override the max_batch_size value, and the resulting record batches will increase to the minimum size needed to store all records associated with the origin. The value for max_batch_size cannot exceed 2,147,483,647. | Integer |
Tipo de datos | Explicación |
Object | An Apache Arrow Table Python object representing the desired output type with the specified fields. |