def setVariables(self, configuration):
        """ Set configuration parameters and create user if required """
        # The table spaces to be used
        self.userName = configuration.get('DB','User')
        self.password = configuration.get('DB','Pass')
        self.dbName = configuration.get('DB','Name')
        self.dbHost = configuration.get('DB','Host')
        self.dbPort = configuration.get('DB','Port')
        
        self.inputFolder = configuration.get('Load','Folder')
        self.srid = configuration.get('Load','SRID')
        self.dataFolder = configuration.get('Load','DataFolder')
        self.sort = configuration.getboolean('Load','Sort')
        self.dataExtension = configuration.get('Load','DataExtension')
        self.numProcessesLoad = configuration.getint('Load','NumberProcesses')

        self.createDB = configuration.getboolean('Load','CreateDB')
        self.dbIndex = configuration.getboolean('Load','DBLASIndex')
        self.lasIndexTableName = configuration.get('Load','DBLASIndexTableName').lower()
        
        
        self.outputExtension = configuration.get('Query','OutputExtension')
        for extension in (self.dataExtension, self.outputExtension):
            if extension not in utils.PC_FILE_FORMATS:
                raise Exception('Accepted extensions/formats for point cloud files are: ' + ','.join(utils.PC_FILE_FORMATS))
        
        self.DM_LASTOOLS = {
            'x': 'x',
            'y': 'y',
            'z': 'z',
            'X': 'X',
            'Y': 'Y',
            'Z': 'Z',
            'i': 'i',
            'r': 'r',
            'n': 'n',
            'd': 'd',
            'e': 'e',
            'c': 'c',
            'a': 'a',
            'u': 'u',
            'p': 'p',
            'R': 'R',
            'G': 'G',
            'B': 'B',
            't': 't',
            'k': 'k'
        }
        utils.checkDimensionMapping(self.DM_LASTOOLS)
 def setVariables(self, configuration):
     """ Set configuration parameters and create user if required """
     # DB connection parameters
     self.userName = configuration.get('DB','User')
     self.password = configuration.get('DB','Pass')
     self.dbName = configuration.get('DB','Name')
     self.dbHost = configuration.get('DB','Host')
     self.dbPort = configuration.get('DB','Port')
     
     #
     # LOADING VARIABLES
     #
     
     # Input data to use
     self.inputFolder = configuration.get('Load','Folder')
     self.srid = configuration.get('Load','SRID')
     self.columns = configuration.get('Load','Columns')
     self.cDB = configuration.getboolean('Load','CreateDB')
     
     # Table spaces to use
     self.tableSpace = configuration.get('Load','TableSpace').strip().upper()
     self.indexTableSpace = configuration.get('Load','IndexTableSpace').strip().upper()
     
     # Get number of processes to be used in Loading
     self.numProcessesLoad = configuration.getint('Load','NumberProcesses')
     self.cluster = configuration.getboolean('Load','Cluster')
     
     # The rest of loading options depend on which mode wer are using (global, incremental, or flat)
     loadingMode = ''
     hasBlockTable = configuration.has_option('Load','BlockTable')
     if hasBlockTable:
         loadingMode = 'BLK'
     else:
         loadingMode = 'FLAT'
     
     if loadingMode == 'BLK':
         self.blockTable = configuration.get('Load','BlockTable').lower()
         self.schemaFile = configuration.get('Load','SchemaFile')
         self.blockSize =  configuration.getint('Load','BlockSize')
     else:
         self.flatTable = configuration.get('Load','FlatTable').lower()
         self.metaTable = configuration.get('Load','MetaTable').lower()
         self.index = configuration.get('Load','Index').lower()
         
     # Variables for queries
     self.queryFile = configuration.get('Query','File')
     self.numUsers = configuration.getint('Query','NumberUsers')
     self.numIterations = configuration.getint('Query','NumberIterations')
     self.queryTable = utils.QUERY_TABLE
     self.numProcessesQuery = configuration.getint('Query','NumberProcesses')
     self.parallelType = configuration.get('Query','ParallelType').lower()
     
     # Dimensions mapping for DB names and types
     self.DM_FLAT = {
         'x': ('x','DOUBLE PRECISION'),
         'y': ('y','DOUBLE PRECISION'),
         'z': ('z','DOUBLE PRECISION'),
         'X': ('ux','INTEGER'),
         'Y': ('uy','INTEGER'),
         'Z': ('uz','INTEGER'),
         'i': ('intensity','INTEGER'),
         'r': ('returnnum','SMALLINT'),
         'n': ('numreturnpulse','SMALLINT'),
         'd': ('dirscanflag','BOOLEAN'),
         'e': ('edgeflightline','BOOLEAN'),
         'c': ('classification','SMALLINT'),
         'a': ('scanangle','SMALLINT'),
         'u': ('userdata','SMALLINT'),
         'p': ('pId','INTEGER'),
         'R': ('R','INTEGER'),
         'G': ('G','INTEGER'),
         'B': ('B','INTEGER'),
         't': ('time','DOUBLE PRECISION'),
         'k': ('morton2D','BIGINT'),
     }
     utils.checkDimensionMapping(self.DM_FLAT)
     
     # Dimensions mapping for las2pg tool
     self.DM_LAS2PG = {
         'x': 'x',
         'y': 'y',
         'z': 'z',
         'X': 'X',
         'Y': 'Y',
         'Z': 'Z',
         'i': 'i',
         'r': 'r',
         'n': 'n',
         'd': 'd',
         'e': 'e',
         'c': 'c',
         'a': 'a',
         'u': 'u',
         'p': 'p',
         'R': 'R',
         'G': 'G',
         'B': 'B',
         't': 't',
         'k': 'k'
     }
     utils.checkDimensionMapping(self.DM_LAS2PG)
     
     # Dimensions mapping for PDAL
     self.DM_PDAL = {
         'x': 'X',
         'y': 'Y',
         'z': 'Z',
         'X': None,
         'Y': None,
         'Z': None,
         'i': 'Intensity',
         'r': 'ReturnNumber',
         'n': 'NumberOfReturns',
         'd': 'ScanDirectionFlag',
         'e': 'EdgeOfFlightLine',
         'c': 'Classification',
         'a': 'ScanAngleRank',
         'u': 'UserData',
         'p': 'PointSourceId',
         'R': 'Red',
         'G': 'Green',
         'B': 'Blue',
         't': 'Time',
         'k': None
     }
     utils.checkDimensionMapping(self.DM_PDAL)
Example #3
0
    def setVariables(self, configuration):
        """ Set configuration parameters and create user if required """
        # The table spaces to be used
        self.userName = configuration.get('DB', 'User')
        self.password = configuration.get('DB', 'Pass')
        self.dbName = configuration.get('DB', 'Name')
        self.dbHost = configuration.get('DB', 'Host')
        self.dbPort = configuration.get('DB', 'Port')
        self.dbDataDir = configuration.get('DB', 'DataDirectory')

        self.inputFolder = configuration.get('Load', 'Folder')
        self.srid = configuration.get('Load', 'SRID')
        self.numProcessesLoad = configuration.getint('Load', 'NumberProcesses')

        self.createDB = configuration.getboolean('Load', 'CreateDB')
        self.columns = configuration.get('Load', 'Columns')
        self.index = configuration.get('Load', 'Index')
        self.imprints = False
        if self.index == 'imprints':
            self.imprints = True

        self.partitioning = configuration.getboolean('Load', 'Partitioning')
        self.numPartitions = configuration.getint('Load', 'NumberPartitions')
        self.decimalDigits = configuration.get('Load', 'DecimalDigits')

        self.flatTable = configuration.get('Load', 'FlatTable').lower()
        self.metaTable = configuration.get('Load', 'MetaTable').lower()

        self.tempDir = self.dbDataDir + '/tmp'
        if not os.path.isdir(self.tempDir):
            os.system('mkdir -p ' + self.tempDir)

        # Dimensions mapping for DB names and types
        self.DM_FLAT = {
            'x': ('x', 'DECIMAL'),
            'y': ('y', 'DECIMAL'),
            'z': ('z', 'DECIMAL'),
            'X': ('ux', 'INTEGER'),
            'Y': ('uy', 'INTEGER'),
            'Z': ('uz', 'INTEGER'),
            'i': ('intensity', 'INTEGER'),
            'r': ('returnnum', 'SMALLINT'),
            'n': ('numreturnpulse', 'SMALLINT'),
            'd': ('dirscanflag', 'BOOLEAN'),
            'e': ('edgeflightline', 'BOOLEAN'),
            'c': ('classification', 'SMALLINT'),
            'a': ('scanangle', 'SMALLINT'),
            'u': ('userdata', 'SMALLINT'),
            'p': ('pId', 'INTEGER'),
            'R': ('R', 'INTEGER'),
            'G': ('G', 'INTEGER'),
            'B': ('B', 'INTEGER'),
            't': ('time', 'DOUBLE PRECISION'),
            'k': ('morton2D', 'BIGINT'),
        }
        for k in self.DM_FLAT:
            if self.DM_FLAT[k][1] == 'DECIMAL':
                self.DM_FLAT[k] = (self.DM_FLAT[k][0], self.DM_FLAT[k][1] +
                                   '(' + self.decimalDigits + ')')

        utils.checkDimensionMapping(self.DM_FLAT)

        # Dimensions mapping for las2col tool
        self.DM_LAS2COL = {
            'x': 'X',
            'y': 'Y',
            'z': 'Z',
            'X':
            '-',  #the normal x is already stored as an integer so this does not apply
            'Y':
            '-',  #the normal x is already stored as an integer so this does not apply
            'Z':
            '-',  #the normal x is already stored as an integer so this does not apply
            'i': 'i',
            'r': 'r',
            'n': 'n',
            'd': 'd',
            'e': 'e',
            'c': 'c',
            'a': 'a',
            'u': 'u',
            'p': 'p',
            'R': 'R',
            'G': 'G',
            'B': 'B',
            't': 't',
            'k': 'k'
        }
        utils.checkDimensionMapping(self.DM_LAS2COL)
Example #4
0
 def setVariables(self, configuration):
     """ Set configuration parameters and create user if required """
     # DB connection parameters
     self.userName = configuration.get('DB','User').upper()
     self.password = configuration.get('DB','Pass')
     self.superUserName = configuration.get('DB','SuperUser') 
     self.superPassword = configuration.get('DB','SuperPass')
     self.dbName = configuration.get('DB','Name')
     self.dbHost = configuration.get('DB','Host')
     self.dbPort = configuration.get('DB','Port')
     
     #
     # LOADING VARIABLES
     #
     
     # Input data to use
     self.inputFolder = configuration.get('Load','Folder')
     self.srid = configuration.get('Load','SRID')
     self.columns = configuration.get('Load','Columns')
     self.cUser = configuration.getboolean('Load','CreateUser')
     # Table spaces to use
     self.tableSpace = configuration.get('Load','TableSpace').strip().upper()
     self.indexTableSpace = configuration.get('Load','IndexTableSpace').strip().upper()
     self.workTableSpace = configuration.get('Load','WorkTableSpace').strip().upper()
     self.tempTableSpace = configuration.get('Load','TempTableSpace').strip().upper()
             
     # Get number of processes to be used in Loading
     self.numProcessesLoad = configuration.getint('Load','NumberProcesses')
     self.tolerance = configuration.get('Load','Tolerance')
             
     # The rest of loading options depend on which mode wer are using (global, incremental, or flat)
     loadingMode = ''
     hasBlockTable = configuration.has_option('Load','BlockTable')
     hasFlatTable = configuration.has_option('Load','FlatTable')
      
     if hasBlockTable:
         if hasFlatTable:
             loadingMode = 'BLK_GLOB'
         else:
             loadingMode = 'BLK_INCR'
     else:
         loadingMode = 'FLAT'
         
     if loadingMode == 'BLK_GLOB':
         self.columnType = 'BINARY_DOUBLE'
         self.blockTable = configuration.get('Load','BlockTable').upper()
         self.baseTable = configuration.get('Load','BaseTable').upper()
 
         self.blockSize =  configuration.get('Load','BlockSize')
         self.blockMethod = configuration.get('Load','BlockMethod').strip().lower()
         self.compression = configuration.get('Load','Compression').strip()
         self.hilbertFactor = configuration.get('Load','HilbertFactor')
     elif loadingMode == 'BLK_INCR':
         self.columnType = 'BINARY_DOUBLE'
         self.blockTable = configuration.get('Load','BlockTable').upper()
         self.baseTable = configuration.get('Load','BaseTable').upper()
         
         self.blockSize =  configuration.get('Load','BlockSize')
         self.batchSize =  configuration.getint('Load','BatchSize')
         self.compression = configuration.get('Load','Compression').strip()
         self.useOffsetScale = configuration.getboolean('Load','PDAL32bitCoordinates')
         self.pdalCompression = configuration.getboolean('Load','PDALCompression')
         self.pdalDimOrientation = configuration.getboolean('Load','PDALDimensionalOrientation')
     else:#if loadingMode == 'FLAT':
         self.columnType = 'NUMBER'
         self.flatTable = configuration.get('Load','FlatTable').upper()
         self.flatTableIOT = configuration.getboolean('Load','FlatTableIOT')
         self.index = configuration.get('Load','Index').lower()
         
         self.metaTable = configuration.get('Load','MetaTable').upper()
     #
     # QUERY VARIABLES
     #
     self.queryFile = configuration.get('Query','File')
     self.numUsers = configuration.getint('Query','NumberUsers')
     self.numIterations = configuration.getint('Query','NumberIterations')
     self.numProcessesQuery = configuration.getint('Query','NumberProcesses')
     self.parallelType = configuration.get('Query','ParallelType').lower()
     self.queryTable = utils.QUERY_TABLE.upper()
     
     self.DM_FLAT = { # The name of the column in the DB is computed with getDBColumn
         'x': self.columnType,
         'y': self.columnType,
         'z': self.columnType,
         'X': 'NUMBER',
         'Y': 'NUMBER',
         'Z': 'NUMBER',
         'i': 'NUMBER',
         'r': 'NUMBER',
         'n': 'NUMBER',
         'd': 'NUMBER',
         'e': 'NUMBER',
         'c': 'NUMBER',
         'a': 'NUMBER',
         'u': 'NUMBER',
         'p': 'NUMBER',
         'R': 'NUMBER',
         'G': 'NUMBER',
         'B': 'NUMBER',
         't': 'NUMBER',
         'k': 'NUMBER',
         'h': 'NUMBER' # Extra dimension for the Hibert code
     }
     utils.checkDimensionMapping(self.DM_FLAT)
     
     self.DM_LAS2TXT = {
         'x': 'x',
         'y': 'y',
         'z': 'z',
         'X': 'X',
         'Y': 'Y',
         'Z': 'Z',
         'i': 'i',
         'r': 'r',
         'n': 'n',
         'd': 'd',
         'e': 'e',
         'c': 'c',
         'a': 'a',
         'u': 'u',
         'p': 'p',
         'R': 'R',
         'G': 'G',
         'B': 'B',
         't': 't',
         'k': 'k'
     }
     utils.checkDimensionMapping(self.DM_LAS2TXT)
     
     self.DM_SQLLDR = {
         'x': ('float', 10),
         'y': ('float', 10),
         'z': ('float', 8),
         'X': ('integer', 10),
         'Y': ('integer', 10),
         'Z': ('integer', 8),
         'i': ('integer', 5),
         'r': ('integer', 3),
         'n': ('integer', 3),
         'd': ('integer', 3),
         'e': ('integer', 3),
         'c': ('integer', 3),
         'a': ('integer', 3),
         'u': ('integer', 3),
         'p': ('integer', 3),
         'R': ('integer', 5),
         'G': ('integer', 5),
         'B': ('integer', 5),
         't': ('float', 10),
         'k': ('integer', 20)
     }
     utils.checkDimensionMapping(self.DM_SQLLDR)
     
     self.DM_PDAL = {
         'x': 'X',
         'y': 'Y',
         'z': 'Z',
         'X': None,
         'Y': None,
         'Z': None,
         'i': 'Intensity',
         'r': 'ReturnNumber',
         'n': 'NumberOfReturns',
         'd': 'ScanDirectionFlag',
         'e': 'EdgeOfFlightLine',
         'c': 'Classification',
         'a': 'ScanAngleRank',
         'u': 'UserData',
         'p': 'PointSourceId',
         'R': 'Red',
         'G': 'Green',
         'B': 'Blue',
         't': 'Time',
         'k': None
     }
     utils.checkDimensionMapping(self.DM_PDAL)
    def setVariables(self, configuration):       
        """ Set configuration parameters and create user if required """
        # The table spaces to be used
        self.userName = configuration.get('DB','User')
        self.password = configuration.get('DB','Pass')
        self.dbName = configuration.get('DB','Name')
        self.dbHost = configuration.get('DB','Host')
        self.dbPort = configuration.get('DB','Port')
        self.dbDataDir = configuration.get('DB','DataDirectory')

        self.inputFolder = configuration.get('Load','Folder')
        self.srid = configuration.get('Load','SRID')
        self.numProcessesLoad = configuration.getint('Load','NumberProcesses')

        self.createDB = configuration.getboolean('Load','CreateDB')
        self.columns = configuration.get('Load','Columns')
        self.index = configuration.get('Load','Index')
        self.imprints = False
        if self.index == 'imprints':
            self.imprints = True
        
        self.partitioning = configuration.getboolean('Load','Partitioning')
        self.numPartitions = configuration.getint('Load','NumberPartitions')
        self.decimalDigits = configuration.get('Load','DecimalDigits')
        
        self.flatTable = configuration.get('Load','FlatTable').lower()
        self.metaTable = configuration.get('Load','MetaTable').lower()
        
        self.tempDir = self.dbDataDir + '/tmp'
        if not os.path.isdir(self.tempDir):
            os.system('mkdir -p ' + self.tempDir)
        
        # Dimensions mapping for DB names and types
        self.DM_FLAT = {
            'x': ('x','DECIMAL'),
            'y': ('y','DECIMAL'),
            'z': ('z','DECIMAL'),
            'X': ('ux','INTEGER'),
            'Y': ('uy','INTEGER'),
            'Z': ('uz','INTEGER'),
            'i': ('intensity','INTEGER'),
            'r': ('returnnum','SMALLINT'),
            'n': ('numreturnpulse','SMALLINT'),
            'd': ('dirscanflag','BOOLEAN'),
            'e': ('edgeflightline','BOOLEAN'),
            'c': ('classification','SMALLINT'),
            'a': ('scanangle','SMALLINT'),
            'u': ('userdata','SMALLINT'),
            'p': ('pId','INTEGER'),
            'R': ('R','INTEGER'),
            'G': ('G','INTEGER'),
            'B': ('B','INTEGER'),
            't': ('time','DOUBLE PRECISION'),
            'k': ('morton2D','BIGINT'),
        }
        for k in self.DM_FLAT:
            if self.DM_FLAT[k][1] == 'DECIMAL':
                self.DM_FLAT[k] = (self.DM_FLAT[k][0], self.DM_FLAT[k][1] + '(' + self.decimalDigits + ')')
        
        utils.checkDimensionMapping(self.DM_FLAT)
        
        # Dimensions mapping for las2col tool
        self.DM_LAS2COL = {
            'x': 'X',
            'y': 'Y',
            'z': 'Z',
            'X': '-', #the normal x is already stored as an integer so this does not apply
            'Y': '-', #the normal x is already stored as an integer so this does not apply
            'Z': '-', #the normal x is already stored as an integer so this does not apply
            'i': 'i',
            'r': 'r',
            'n': 'n',
            'd': 'd',
            'e': 'e',
            'c': 'c',
            'a': 'a',
            'u': 'u',
            'p': 'p',
            'R': 'R',
            'G': 'G',
            'B': 'B',
            't': 't',
            'k': 'k'
        }
        utils.checkDimensionMapping(self.DM_LAS2COL)
Example #6
0
    def setVariables(self, configuration):
        """ Set configuration parameters and create user if required """
        # DB connection parameters
        self.userName = configuration.get('DB', 'User')
        self.password = configuration.get('DB', 'Pass')
        self.dbName = configuration.get('DB', 'Name')
        self.dbHost = configuration.get('DB', 'Host')
        self.dbPort = configuration.get('DB', 'Port')

        #
        # LOADING VARIABLES
        #

        # Input data to use
        self.inputFolder = configuration.get('Load', 'Folder')
        self.srid = configuration.get('Load', 'SRID')
        self.columns = configuration.get('Load', 'Columns')
        self.cDB = configuration.getboolean('Load', 'CreateDB')

        # Table spaces to use
        self.tableSpace = configuration.get('Load',
                                            'TableSpace').strip().upper()
        self.indexTableSpace = configuration.get(
            'Load', 'IndexTableSpace').strip().upper()

        # Get number of processes to be used in Loading
        self.numProcessesLoad = configuration.getint('Load', 'NumberProcesses')
        self.cluster = configuration.getboolean('Load', 'Cluster')

        # The rest of loading options depend on which mode wer are using (global, incremental, or flat)
        loadingMode = ''
        hasBlockTable = configuration.has_option('Load', 'BlockTable')
        if hasBlockTable:
            loadingMode = 'BLK'
        else:
            loadingMode = 'FLAT'

        if loadingMode == 'BLK':
            self.blockTable = configuration.get('Load', 'BlockTable').lower()
            self.schemaFile = configuration.get('Load', 'SchemaFile')
            self.blockSize = configuration.getint('Load', 'BlockSize')
        else:
            self.flatTable = configuration.get('Load', 'FlatTable').lower()
            self.metaTable = configuration.get('Load', 'MetaTable').lower()
            self.index = configuration.get('Load', 'Index').lower()

        # Variables for queries
        self.queryFile = configuration.get('Query', 'File')
        self.numUsers = configuration.getint('Query', 'NumberUsers')
        self.numIterations = configuration.getint('Query', 'NumberIterations')
        self.queryTable = utils.QUERY_TABLE
        self.numProcessesQuery = configuration.getint('Query',
                                                      'NumberProcesses')
        self.parallelType = configuration.get('Query', 'ParallelType').lower()

        # Dimensions mapping for DB names and types
        self.DM_FLAT = {
            'x': ('x', 'DOUBLE PRECISION'),
            'y': ('y', 'DOUBLE PRECISION'),
            'z': ('z', 'DOUBLE PRECISION'),
            'X': ('ux', 'INTEGER'),
            'Y': ('uy', 'INTEGER'),
            'Z': ('uz', 'INTEGER'),
            'i': ('intensity', 'INTEGER'),
            'r': ('returnnum', 'SMALLINT'),
            'n': ('numreturnpulse', 'SMALLINT'),
            'd': ('dirscanflag', 'BOOLEAN'),
            'e': ('edgeflightline', 'BOOLEAN'),
            'c': ('classification', 'SMALLINT'),
            'a': ('scanangle', 'SMALLINT'),
            'u': ('userdata', 'SMALLINT'),
            'p': ('pId', 'INTEGER'),
            'R': ('R', 'INTEGER'),
            'G': ('G', 'INTEGER'),
            'B': ('B', 'INTEGER'),
            't': ('time', 'DOUBLE PRECISION'),
            'k': ('morton2D', 'BIGINT'),
        }
        utils.checkDimensionMapping(self.DM_FLAT)

        # Dimensions mapping for las2pg tool
        self.DM_LAS2PG = {
            'x': 'x',
            'y': 'y',
            'z': 'z',
            'X': 'X',
            'Y': 'Y',
            'Z': 'Z',
            'i': 'i',
            'r': 'r',
            'n': 'n',
            'd': 'd',
            'e': 'e',
            'c': 'c',
            'a': 'a',
            'u': 'u',
            'p': 'p',
            'R': 'R',
            'G': 'G',
            'B': 'B',
            't': 't',
            'k': 'k'
        }
        utils.checkDimensionMapping(self.DM_LAS2PG)

        # Dimensions mapping for PDAL
        self.DM_PDAL = {
            'x': 'X',
            'y': 'Y',
            'z': 'Z',
            'X': None,
            'Y': None,
            'Z': None,
            'i': 'Intensity',
            'r': 'ReturnNumber',
            'n': 'NumberOfReturns',
            'd': 'ScanDirectionFlag',
            'e': 'EdgeOfFlightLine',
            'c': 'Classification',
            'a': 'ScanAngleRank',
            'u': 'UserData',
            'p': 'PointSourceId',
            'R': 'Red',
            'G': 'Green',
            'B': 'Blue',
            't': 'Time',
            'k': None
        }
        utils.checkDimensionMapping(self.DM_PDAL)