Exemplo n.º 1
0
    def loadFromFile(self, index, fileAbsPath):
        # Get connection
        connection = self.getConnection()
        cursor = connection.cursor()
        # Add point cloud format to poinctcloud_formats table
        (columns, pcid,
         compression) = self.addPCFormat(cursor, self.schemaFile, fileAbsPath,
                                         self.srid)
        connection.close()

        pdalCols = []
        for c in cols:
            pdalCols.append(self.DM_PDAL[c])

        # Get PDAL config and run PDAL
        xmlFile = os.path.basename(fileAbsPath) + '.xml'
        pdalops.PostgreSQLWriter(xmlFile, fileAbsPath,
                                 self.getConnectionString(), pcid, pdalCols,
                                 self.blockTable, self.srid, self.blockSize,
                                 compression)
        t0 = time.time()
        pdalops.executePDAL(xmlFile)
        print 'LOADSTATS', os.path.basename(
            fileAbsPath), lasops.getPCFileDetails(
                fileAbsPath)[1], time.time() - t0
Exemplo n.º 2
0
    def query(self, queryId, iterationId, queriesParameters):    
        (eTime, result) = (-1, None)    
        self.prepareQuery(None, queryId, queriesParameters, False)
        
        if self.qp.queryMethod == 'stat' or self.qp.queryType == 'nn' or self.qp.minz != None or self.qp.maxz != None:
            # PDAL can not generate stats or run NN queries or Z queries 
            return (eTime, result) 

        xmlFile = 'pdal' +  str(self.queryIndex) + '.xml'
        if self.qp.queryMethod != 'stream':
            outputFileAbsPath = 'output' +  str(self.queryIndex) + '.las'
            pdalops.PostgreSQLReaderLAS(xmlFile, outputFileAbsPath, self.getConnectionString(), self.blockTable, self.srid, self.qp.wkt)
        else:
            pdalops.PostgreSQLReaderStdOut(xmlFile, self.getConnectionString(), self.blockTable, self.srid, self.qp.wkt)
            
        t0 = time.time()
        if self.qp.queryMethod != 'stream': # disk or stat
            pdalops.executePDAL(xmlFile)
            eTime = time.time() - t0
            result = lasops.getNumPoints(outputFileAbsPath)
            os.system('rm ' + outputFileAbsPath)     
        else:
            result = pdalops.executePDALCount(xmlFile)
            eTime = time.time() - t0
        return (eTime, result)
Exemplo n.º 3
0
 def loadFromFile(self, index, fileAbsPath):
     # Get information of the contents of the LAS file
     logging.info(fileAbsPath)
     xmlFile = os.path.basename(fileAbsPath) + '.xml'
     if self.columns == 'all':
         pdalCols = None
     else:
         pdalCols = []
         for c in self.columns:
             pdalCols.append(self.DM_PDAL[c])
             
     useOffsetScale = self.useOffsetScale
     pdalops.OracleWriter(xmlFile, fileAbsPath, self.getConnectionString(), pdalCols, self.blockTable, self.baseTable, self.srid, self.blockSize, self.pdalCompression, self.pdalDimOrientation, useOffsetScale)
     t0 = time.time()
     pdalops.executePDAL(xmlFile)
     print 'LOADSTATS', os.path.basename(fileAbsPath), lasops.getPCFileDetails(fileAbsPath)[1], time.time() - t0
Exemplo n.º 4
0
    def query(self, queryId, iterationId, queriesParameters):
        (eTime, result) = (-1, None)
        connection = self.getConnection()
        cursor = connection.cursor()
        self.prepareQuery(cursor, queryId, queriesParameters, iterationId == 0)
        connection.close()

        if self.qp.queryMethod == "stat" or self.qp.queryType == "nn" or self.qp.minz != None or self.qp.maxz != None:
            # PDAL can not generate stats or run NN queries or Z queries
            return (eTime, result)
        xmlFile = "pdal" + str(self.queryIndex) + ".xml"
        if self.qp.queryMethod != "stream":
            outputFileAbsPath = "output" + str(self.queryIndex) + ".las"
            pdalops.OracleReaderLAS(
                xmlFile,
                outputFileAbsPath,
                self.getConnectionString(),
                self.blockTable,
                self.baseTable,
                self.srid,
                self.qp.wkt,
                self.queryTable,
                self.queryIndex,
            )
        else:
            pdalops.OracleReaderStdOut(
                xmlFile,
                self.getConnectionString(),
                self.blockTable,
                self.baseTable,
                self.srid,
                self.qp.wkt,
                self.queryTable,
                self.queryIndex,
            )

        t0 = time.time()
        if self.qp.queryMethod != "stream":  # disk or stat
            pdalops.executePDAL(xmlFile)
            eTime = time.time() - t0
            result = lasops.getNumPoints(outputFileAbsPath)
            os.system("rm " + outputFileAbsPath)
        else:
            result = pdalops.executePDALCount(xmlFile)
            eTime = time.time() - t0
        return (eTime, result)
Exemplo n.º 5
0
    def loadFromFile(self, index, fileAbsPath):
        # Get connection
        connection = self.getConnection()
        cursor = connection.cursor()
        # Add point cloud format to poinctcloud_formats table
        (columns, pcid, compression) = self.addPCFormat(cursor, self.schemaFile, fileAbsPath, self.srid)
        connection.close()

        pdalCols = []
        for c in cols:
            pdalCols.append(self.DM_PDAL[c])

        # Get PDAL config and run PDAL
        xmlFile = os.path.basename(fileAbsPath) + '.xml'
        pdalops.PostgreSQLWriter(xmlFile, fileAbsPath, self.getConnectionString(), pcid, pdalCols, self.blockTable, self.srid, self.blockSize, compression)
        t0 = time.time()
        pdalops.executePDAL(xmlFile)
        print 'LOADSTATS', os.path.basename(fileAbsPath), lasops.getPCFileDetails(fileAbsPath)[1], time.time() - t0
Exemplo n.º 6
0
    def loadFromFile(self, index, fileAbsPath):
        # Get connection
        connection = self.getConnection()
        cursor = connection.cursor()
        #Create a temporal blocks table for the blocks of the current file
        fileBlockTable = self.getFileBlockTable(index)
        self.createBlocksTable(cursor, fileBlockTable, self.indexTableSpace) # We use the index table space for the temporal table
        
        # Add point cloud format to poinctcloud_formats table
        (columns, pcid, compression) = self.addPCFormat(cursor, self.schemaFile, fileAbsPath, self.srid)
        connection.close()

        pdalCols = []
        for c in cols:
            pdalCols.append(self.DM_PDAL[c])

        # Get PDAL config and run PDAL
        xmlFile = os.path.basename(fileAbsPath) + '.xml'
        pdalops.PostgreSQLWriter(xmlFile, fileAbsPath, self.getConnectionString(), pcid, pdalCols, fileBlockTable, self.srid, self.blockSize, compression)
        pdalops.executePDAL(xmlFile)