tileManager Class Reference

Public Member Functions

def __init__ (self, logger, inFileDicts, tilingStr, namingStr, tempdir, nbThreads=0, buffer=0, aoi=None, resultFileNames=None, skipIfExists=0, shapefileExport=False, do_cut=True)
 
def save_as_textfile (self, outpath)
 
def load_from_textfile (self, inpath)
 
def parseNamingString (self)
 
def parseTilingString (self)
 
Tries to grasp the tiling concept. More...
 
def tile (self)
 
def cut (self, do_cut)
 
def __iter__ (self)
 
def __len__ (self)
 
def __next__ (self)
 
def next (self)
 
def tileCount (self)
 
def cutToNetSize (self, nexttileDict, rasterfiles=list(), vectorfiles=list(), overwrite=True)
 
def printStatistics (self)
 

Public Attributes

 logger
 
 inFileDicts
 
 inVectorFiles
 
 inRasterFiles
 
 overallBBox
 
 requiredBBox
 
 shapefile_export
 
 do_cut
 
 thread_number
 
 aoi
 
 tilingStr
 
 namingStr
 
 tempdir
 
 buffer
 
 curTileId
 
 resultFileNames
 
 skipIfExists
 
 tiles
 
 completedTiles
 
 skippedTiles
 
 failedTiles
 
 tilingConcept
 
 namingConcept
 
 namingDelimiter
 
 namingnDigits
 
 namingCorner
 
 tileFile
 
 tileRows
 
 tileCols
 
 tileSize
 
 TiledFiles
 

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  logger,
  inFileDicts,
  tilingStr,
  namingStr,
  tempdir,
  nbThreads = 0,
  buffer = 0,
  aoi = None,
  resultFileNames = None,
  skipIfExists = 0,
  shapefileExport = False,
  do_cut = True 
)
     Instantiates a tileManager-Object.
     :param inFileDicts: List of dictionaries containing information about input files. Has to look like:\n
     inFileDicts = [{'files': [r'DSM\1.odm',\n
                           r'DSM\2.odm',\n
                           r'DSM\3.odm',\n
                           r'DSM\4.odm'], # List of Files (relative or full path, no */?)\n
                 'type': 'odm', # either odm or raster\n
                 'name': 'dsm', # any name that can be used as a dict key and a (windows) filename\n
                 'required': True},\n
                {'files': [r'DTM\1.tif',\n
                           r'DTM\2.tif',\n
                           r'DTM\3.tif',\n
                           r'DTM\4.tif'],\n
                 'type': 'raster',\n
                 'name': 'dtm',\n
                 'required': False},\n
                {'files': [r'1.odm'],\n
                 'type': 'odm',\n
                 'name': 'ndsm',\n
                 'required': False}]\n
     :param tilingStr: a string for a tiling concept that can be processed with parseTilingString(), or None\n
     :param tempdir: name of a temporary directory (will be created if not exists)\n
     :param buffer: amount with which to buffer the individual tiles (meters, use 0 for no buffer)\n
     :param aoi: area of interest to which tiling should be confined to\n
     :return: None

References forTopHeight.aoi, tileManager.aoi, forDelineate.buffer, preCutting.buffer, tileManager.buffer, tileManager.completedTiles, tileManager.curTileId, tileManager.do_cut, tileManager.failedTiles, tileManager.inFileDicts, tileManager.inRasterFiles, tileManager.inVectorFiles, local.logger, Dispatcher.logger, tileManager.logger, forDelineate.logger, gearman.logger, tileManager.namingStr, tileManager.overallBBox, tileManager.parseNamingString(), tileManager.parseTilingString(), tileManager.requiredBBox, tileManager.resultFileNames, tileManager.shapefile_export, clfTreeModelApply.skipIfExists, clfTreeModelTrain.skipIfExists, preAttribute.skipIfExists, preOutlierDetection.skipIfExists, _bounds.skipIfExists, _export.skipIfExists, _overlap.skipIfExists, _import.skipIfExists, grfApprox.skipIfExists, grfExport.skipIfExists, qltDSM.skipIfExists, qltLSM.skipIfExists, opalsGeoref.skipIfExists, _grid.skipIfExists, qltAccuracy.skipIfExists, opalsPreprocess.skipIfExists, qltStripDiff.skipIfExists, opalsHelios.skipIfExists, preTiling.skipIfExists, tileManager.skipIfExists, opalsQuality.skipIfExists, preCutting.skipIfExists, forDSM.skipIfExists, tileManager.skippedTiles, tileManager.tempdir, tileManager.thread_number, forDelineate.thread_number, tileManager.tiles, and tileManager.tilingStr.

Member Function Documentation

◆ __next__()

def __next__ (   self)
     Method for getting a dict of files for the next tile. The dict will look like this:\n
     {'tile_id': Integer (list index) to represent a tile number\n
      'sample1': (relative) Path to input tile of class 'sample1', e.g. 'path/to/sample1.tif'\n
      'sample2': (relative) Path to input tile of class 'sample2', e.g. 'path/to/sample2.odm'\n
      [...]\n
      'type': 'bbox' or 'poly'\n
      'bbox': rasterfun.bbox() covering the tile\n
      'buffered_region_filter': Filter String containing region vertices, with buffer\n
      'region_filter': See above, without buffer\n
      [optional] 'buffered_shapefile_name': path to a shapefile containing single polygon of buffered tile\n
      [optional] 'shapefile_name': path to a shapefile containing single polygon of unbuffered tile (for cutting)\n
      'tile_name': Suffix/Partial Name that should be used for naming of output files\n
     }\n
     :return: tiledict of the next tile

References tileManager.__next__(), tileManager.curTileId, local.logger, Dispatcher.logger, tileManager.logger, forDelineate.logger, gearman.logger, tileManager.next(), Import.next(), tileManager.resultFileNames, tileManager.shapefile_export, _export.skipIfExists, _overlap.skipIfExists, preAttribute.skipIfExists, preOutlierDetection.skipIfExists, clfTreeModelApply.skipIfExists, clfTreeModelTrain.skipIfExists, _bounds.skipIfExists, _import.skipIfExists, grfExport.skipIfExists, qltLSM.skipIfExists, qltDSM.skipIfExists, grfApprox.skipIfExists, opalsGeoref.skipIfExists, _grid.skipIfExists, qltAccuracy.skipIfExists, opalsPreprocess.skipIfExists, qltStripDiff.skipIfExists, opalsHelios.skipIfExists, preTiling.skipIfExists, tileManager.skipIfExists, opalsQuality.skipIfExists, preCutting.skipIfExists, forDSM.skipIfExists, tileManager.skippedTiles, tileManager.tempdir, tileManager.TiledFiles, and tileManager.tiles.

Referenced by tileManager.__next__().

◆ cutToNetSize()

def cutToNetSize (   self,
  nexttileDict,
  rasterfiles = list(),
  vectorfiles = list(),
  overwrite = True 
)
     Cuts all input Files (odm or raster) to the net size by exporting with filter of unbuffered poly\n
     Will create temporary files, but will delete them afterwards.\n
     In case of axes-parallel rectangle tiling, uses limit instead of filter.\n
     Relies on gdal_rasterize as of 2016-03-24, since opalsRasterize seems to have issues.\n
     :param: nexttileDict\n
     :param: rasterfiles\n
     :param: vectorfiles\n
     :return: Nothing.

References tileManager.tempdir.

◆ load_from_textfile()

def load_from_textfile (   self,
  inpath 
)
     to be implemented\n
     :param inpath:\n
     :return: None

◆ parseNamingString()

def parseNamingString (   self)
     Parses the naming\n
     :return: None\n

References tileManager.namingConcept, tileManager.namingCorner, tileManager.namingDelimiter, tileManager.namingnDigits, tileManager.namingStr, and tileManager.tilingConcept.

Referenced by tileManager.__init__().

◆ parseTilingString()

def parseTilingString (   self)


Tries to grasp the tiling concept.


Possibilities:

  • shapefile (e.g. "path/to/shape.shp")
  • size (e.g. "2000" or "2000 3000")
  • rows/cols (e.g. "2r3c", "5c3r")
  • name of an input class (e.g. "dtm", "scan", ..)
    Raises an Exception if the String makes no sense.
    :return: Nothing.

References tileManager.inRasterFiles, tileManager.inVectorFiles, tileManager.tileCols, tileManager.tileFile, tileManager.tileRows, IndexDescription.tileSize, opalsPreprocess.tileSize, preTiling.tileSize, forDSM.tileSize, tileManager.tileSize, tileManager.tilingConcept, and tileManager.tilingStr.

Referenced by tileManager.__init__().

◆ printStatistics()

def printStatistics (   self)
     Prints statistics after processing.\n
     :param tiles_completed: count of tiles that were processed normally\n
     :param tiles_skipped: count of tiles that were skipped (e.g. emtpy tile)\n
     :param tiles_failed: count of tiles that failed (with errors)\n
     :return: prints statistic information\n

References tileManager.completedTiles, tileManager.failedTiles, local.logger, Dispatcher.logger, tileManager.logger, forDelineate.logger, gearman.logger, tileManager.skippedTiles, and tileManager.tileCount().

◆ save_as_textfile()

def save_as_textfile (   self,
  outpath 
)
     to be implemented\n
     :param outpath:\n
     :return: None

◆ tile()

def tile (   self)
     Creates the tiling concept based on the input parameters to the __init__ method.\n
     Run this after instantiating the class, and parsing naming and tiling strings,
     but before grabbing the first tile.\n
     :return: Nothing.

References forDelineate.buffer, preCutting.buffer, tileManager.buffer, tileManager.curTileId, tileManager.cut(), tileManager.do_cut, tileManager.inFileDicts, tileManager.inRasterFiles, tileManager.inVectorFiles, local.logger, Dispatcher.logger, tileManager.logger, forDelineate.logger, gearman.logger, tileManager.namingConcept, tileManager.namingCorner, tileManager.namingDelimiter, tileManager.namingnDigits, tileManager.namingStr, tileManager.requiredBBox, tileManager.tempdir, tileManager.thread_number, forDelineate.thread_number, tileManager.tile(), tileManager.tileCols, tileManager.TiledFiles, tileManager.tileFile, tileManager.tileRows, tileManager.tiles, IndexDescription.tileSize, opalsPreprocess.tileSize, preTiling.tileSize, forDSM.tileSize, tileManager.tileSize, tileManager.tilingConcept, and tileManager.tilingStr.

Referenced by tileManager.tile().