GeoEco.DataManagement.ArcGISRasters.ArcGISRaster.FindAndConvertToLines

classmethod ArcGISRaster.FindAndConvertToLines(inputWorkspace, outputWorkspace, backgroundValue='ZERO', minDangleLength=0.0, simplify=True, field=None, wildcard='*', searchTree=False, rasterType=None, projectedCoordinateSystem=None, geographicTransformation=None, resamplingTechnique=None, projectedCellSize=None, registrationPoint=None, clippingDataset=None, clippingRectangle=None, mapAlgebraExpression=None, outputFeatureClassPythonExpression='os.path.join(outputWorkspace, inputRaster[len(workspaceToSearch)+1:])', modulesToImport=['os.path'], skipExisting=False, overwriteExisting=False)

Finds rasters in an ArcGIS workspace and converts them to lines that outline groups of adjacent raster cells having the same value.

Parameters:
  • inputWorkspace (str) – Workspace to search. Minimum length꞉ 1. Must exist.

  • outputWorkspace (str) – Workspace to receive the line feature classes. Minimum length꞉ 1.

  • backgroundValue (str, optional) –

    Specifies the cell value that will identify the background cells. The raster dataset is viewed as a set of foreground cells and background cells. The linear features are formed from the foreground cells.

    • ZERO - The background is composed of cells of zero or less or NoData. All cells with a value greater than zero are considered a foreground value.

    • NODATA - The background is composed of NoData cells. All cells with valid values belong to the foreground.

    Allowed values꞉ 'ZERO', 'NODATA'.

  • minDangleLength (float, optional) – Minimum length of dangling lines that will be retained. The default is zero. Minimum value꞉ 0.0.

  • simplify (bool, optional) – If True (the default) the output lines will be smoothed according to an undocumented algorithm implemented by the ArcGIS RastertoPolyline() tool.

  • field (str, optional) – The field used to assign values from the cells in the input raster to the lines in the output dataset. It can be an integer or a string field. Minimum length꞉ 1. Must exist.

  • wildcard (str, optional) – Wildcard expression specifying the rasters to find. Please see the documentation for the ArcGIS ListRasters() function for more information about the syntax. At the time of this writing, only the * wildcard character was supported, which would match zero or more of any character. Minimum length꞉ 1.

  • searchTree (bool, optional) – If True, child workspaces will be searched.

  • rasterType (str, optional) – Type of rasters to find. If provided, only rasters of this type will be found. At the time of this writing, the ArcGIS Pro 3.2 documentation specified that any of the following strings would be accepted: All (the default), BMP, GIF, GRID, IMG, JP2, JPG, PNG, TIFF. Minimum length꞉ 1.

  • projectedCoordinateSystem (str, optional) – New coordinate system to project the raster to. The raster may only be projected to a new coordinate system if the original projection is defined. An error will be raised if you specify a new coordinate system without defining the original coordinate system. The ArcGIS ProjectRaster() tool is used to perform the projection. The documentation for that tool recommends that you also specify a cell size for the new coordinate system. Minimum length꞉ 1.

  • geographicTransformation (str, optional) –

    A transformation method used to convert between the original coordinate system and the new coordinate system.

    This parameter is only needed when you specify that the raster should be projected to a new coordinate system and that new system uses a different datum than the original coordinate system, or there is some other difference between the two coordinate systems that requires a transformation. To determine if a transformation is needed:

    • First, run this tool without specifying a new coordinate system, to obtain the raster in the original coordinate system.

    • Next, use the ArcGIS ProjectRaster() tool on the raster to project it to the desired coordinate system. If a geographic transformation is needed, that tool will prompt you for one. Write down the exact name of the transformation you used.

    • Finally, if a transformation was needed, type in the exact name into this tool, rerun it, and verify that the raster was projected as you desired.

    Minimum length꞉ 1.

  • resamplingTechnique (str, optional) –

    The resampling algorithm to be used to project the original raster to a new coordinate system. The ArcGIS ProjectRaster() tool is used to perform the projection and accepts the following values:

    You must specify one of these algorithms to project to a new coordinate system. An error will be raised if you specify a new coordinate system without selecting an algorithm.

    Allowed values꞉ 'NEAREST', 'BILINEAR', 'CUBIC'. Case sensitive.

  • projectedCellSize (float, optional) – The cell size of the projected coordinate system. Although this parameter is optional, to receive the best results, the ArcGIS documentation recommends you always specify it when projecting to a new coordinate system.

  • registrationPoint (str, optional) – The x and y coordinates (in the projected coordinate system) used for cell alignment. This parameter is ignored if you do not specify that the raster should be projected to a new coordinate system. Minimum length꞉ 1. Must match regular expression꞉ ([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)\s+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?).

  • clippingDataset (str, optional) – Existing feature class, raster, or other geographic dataset having the extent to which the raster should be clipped. Minimum length꞉ 1. Must exist.

  • clippingRectangle (str, optional) –

    Rectangle to which the raster should be clipped. This should only be given if the clipping dataset parameter is omitted.

    If a projected coordinate system was specified, the clipping is performed after the projection and the rectangle’s coordinates should be specified in the projected coordinate system. If no projected coordinate system was specified, the coordinates should be specified in the original coordinate system.

    The ArcGIS Clip() tool is used to perform the clip. The clipping rectangle must be passed to this tool as a string of four numbers separated by spaces. The ArcGIS user interface automatically formats the string properly; when invoking this tool from the ArcGIS UI, you need not worry about the format. But when invoking it programmatically, take care to provide a properly-formatted string. The numbers are ordered LEFT, BOTTOM, RIGHT, TOP. For example, if the raster is in a geographic coordinate system, it may be clipped to 10 W, 15 S, 20 E, and 25 N with the string '10 15 20 25'. Integers or decimal numbers may be provided.

    Minimum length꞉ 1. Must match regular expression꞉ ([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)\s+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)\s+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)\s+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?).

  • mapAlgebraExpression (str, optional) – Map algebra expression to execute on the raster. The expression is executed after the converted raster is projected and clipped (if those options are specified). Use inputRaster to represent the raster that you now want to perform map algebra upon. For example, to convert the raster to an integer raster and add 1 to all of the cells, use the expression Int(inputRaster) + 1. Minimum length꞉ 1. Maximum length꞉ 4000. Requires: ArcGIS ‘spatial’ extension. Requires: ArcGIS ‘spatial’ extension.

  • outputFeatureClassPythonExpression (str, optional) –

    Python expression used to calculate the absolute path of an output feature class. The expression may be any Python statement appropriate for passing to the eval function and must return a string. The expression may reference the following variables:

    • workspaceToSearch - the value provided for the workspace to search parameter

    • outputWorkspace - the value provided for the output workspace parameter

    • inputRaster - the absolute path to the input raster

    The default expression, os.path.join(outputWorkspace, inputRaster[len(workspaceToSearch)+1:]), stores the feature classes in the output workspace at the same relative location as the input rasters in the workspace to search. The feature class path is calculated by stripping the workspace to search from the input raster path and replacing it with the output workspace.

    For more information on Python syntax, please see the Python documentation.

    Minimum length꞉ 1.

  • modulesToImport (list of str, optional) – Python modules to import prior to evaluating the expression. If you need to access Python functions or classes that are provided by a module rather than being built-in to the interpreter, list the module here. For example, to be able to use the datetime class in your expression, list the datetime module here. In your expression, you must refer to the class using its fully-qualified name, datetime.datetime.

  • skipExisting (bool, optional) – If True, conversion will be skipped for feature classes that already exist.

  • overwriteExisting (bool, optional) – If True and skipExisting is False, existing feature classes will be overwritten.

Returns:

Workspace to receive the line feature classes.

Return type:

str