GeoEco.DataManagement.ArcGISRasters.ArcGISRaster.FindAndFillTable

classmethod ArcGISRaster.FindAndFillTable(workspace, insertCursor, rasterField, wildcard='*', searchTree=False, rasterType=None, relativePathField=None, basePath=None, populateExtentFields=False, parsedDateField=None, dateParsingExpression=None, unixTimeField=None)

Finds rasters within an ArcGIS workspace and inserts a row for each one into an existing table.

Rasters are returned in an arbitrary order determined by ArcGIS.

Requires: ArcGIS Pro 3.2.0 or later or ArcGIS Server equivalent to ArcGIS Pro 3.2.0 or later.

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

  • insertCursor (InsertCursor) – Insert cursor opened to the table that will receive the rows. The cursor will still be open when this function returns.

  • rasterField (str) – Name of the field to receive absolute paths to the rasters that were found. Minimum length꞉ 1.

  • 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.

  • relativePathField (str, optional) –

    Name of the field to receive paths of the rasters that were found, relative to basePath. For example, if basePath was:

    C:\Data\Rasters
    

    the relative paths for the rasters:

    C:\Data\Rasters\Group1\r1
    C:\Data\Rasters\r1
    C:\Data\r1
    C:\r1
    D:\r1
    \\MyServer\Data\r1
    

    would be:

    Group1\r1
    r1
    ..\r1
    ..\..\r1
    D:\r1
    \\MyServer\Data\r1
    

    Minimum length꞉ 1.

  • basePath (str, optional) – Absolute path from which relative paths will be calculated and stored in the relativePathField. Please see the documentation for that field for more information. Minimum length꞉ 1.

  • populateExtentFields (bool, optional) – If True, the fields named XMin, YMin, XMax, and YMax will be populated with the rasters’ extents. If you populate these fields and store the rasters’ paths in a field named Image, ArcGIS will treat your table as an unmanaged raster catalog and enable additional functionality from the ArcGIS user interface, such as time series animations.

  • parsedDateField (str, optional) – Name of the field to receive dates parsed from the paths of the rasters that were found. You must also specify a date parsing expression. Minimum length꞉ 1.

  • dateParsingExpression (str, optional) –

    Expression for parsing dates from the paths of the rasters that were found. The expression will be ignored if you do not also specify a field to receive the dates or the equivalent UNIX time.

    The expression is a standard Python Regular Expression Syntax with additional codes for matching fragments of dates:

    %d - Day of the month as a decimal number (range: 01 to 31)

    %H - Hour (24-hour clock) as a decimal number (range: 00 to 23)

    %j - Day of the year as a decimal number (range: 001 to 366)

    %m - Month as a decimal number (range: 01 to 12)

    %M - Minute as a decimal number (range: 00 to 59)

    %S - Second as a decimal number (range: 00 to 61)

    %y - Year without century as a decimal number (range: 00 to 99)

    %Y - Year with century as a decimal number (range: 0001 to 9999)

    %% - A literal % character

    A date is parsed from a path as follows:

    1. The date fragment codes in your expression are replaced by regular expression groups to produce a true regular expression. For example, if your expression is %Y_%m_%d, it is converted to the regular expression (\d\d\d\d)_(\d\d)_(\d\d).

    2. re.search() is invoked to find the first occurrence of the regular expression in the path. The search proceeds from left to right.

    3. If an occurrence is found, the regular expression groups are extracted and time.strptime() is invoked to parse a date from the groups.

    Notes:

    • Your expression must include at least one date fragment code, but it need not include all of them. If a particular code is missing, the following default values will be used: year 1900, month 01, day 01, hour 00, minute 00, second 00.

    • You cannot specify a given date fragment code more than once.

    • You cannot specify date fragment codes that might conflict. For example, you cannot specify both %j and %d because this could result in conflicting values for the day.

    • For %y, values 00 to 68 are interpreted as years 2000 through 2068, while 69 through 99 are interpreted as years 1969 through 1999.

    • Remember that the entire path is searched for your expression, from left to right. The first occurrence of it may be in the parent directories.

    • The date fragment codes are case-sensitive.

    • If the underlying storage format can hold the time as well as the date in a single field, the time will be stored along with the date. If the table cannot hold the time and date in a single field, then only the date will be stored. This is the case, for example, with dBASE III and IV tables (.dbf files), often used by ArcGIS.

    • The timezone of the parsed date is assumed to be UTC.

    Examples:

    The expression:

    %Y%j
    

    will parse dates from rasters namd with the year and day of year:

    C:\SST\Rasters\2006\sst2006001
    C:\SST\Rasters\2006\sst2006002
    C:\SST\Rasters\2006\sst2006003
    

    Note that, in this example, the 2006 is parsed from the raster name, not the 2006 directory, because the directory is not followed by a day of year, it is followed by a backslash. The date parsing expression will only match a year followed by a day of year.

    Minimum length꞉ 1.

  • unixTimeField (str, optional) –

    Name of the field to receive dates, in “UNIX time” format, parsed from the paths of the rasters that were found. You must also specify a date parsing expression.

    UNIX times are 32-bit signed integers that are the number of seconds since 1970-01-01 00:00:00 UTC. This tool assumes the date that was parsed is in the UTC timezone. The UNIX time values produced by this tool do not include leap seconds; this tool assumes that a regular year is 31536000 seconds and a leap year is 31622400 seconds. Minimum length꞉ 1.