Ejemplo n.º 1
0
 def __runFastGeoreferencing__(self, georefObject, messtischblatt, tmpDir, destPath):    
     try:                           
         gcps = createGCPs(georefObject.clipparameter, messtischblatt.BoundingBoxObj.getCornerPointsAsList(), messtischblatt.zoomify_height)
         return georeference(messtischblatt.original_path, destPath, tmpDir, gcps, DATABASE_SRID, DATABASE_SRID, 'polynom', self.logger)
     except:
         self.logger.error('Something went wrong while trying to process a fast georefercing process')
         raise
Ejemplo n.º 2
0
    def __runStableGeoreferencing__(self, georefObject, messtischblatt, tmpDir,
                                    destPath):
        try:
            # create a shapefile which represents the boundingbox of the messtischblatt and is latery used for clipping
            shpPath = messtischblatt.BoundingBoxObj.asShapefile(
                os.path.join(tmpDir, "shape"))
            gcps = createGCPs(
                georefObject.clipparameter,
                messtischblatt.BoundingBoxObj.getCornerPointsAsList(),
                messtischblatt.zoomify_height)
            georeference_result_file = georeference(
                messtischblatt.original_path, destPath, tmpDir, gcps,
                DATABASE_SRID, DATABASE_SRID, 'polynom', self.logger, shpPath)

            # add overviews
            if self.__executeCommands__(
                    "gdaladdo --config GDAL_CACHEMAX 500 -r average %s %s" %
                (georeference_result_file, GEOREFERENCE_OVERVIEW_LEVELS)):
                return destPath
            else:
                raise GeoreferenceProcessRunningError(
                    'Something went wrong while trying to process a georefercing process'
                )
        except:
            self.logger.error(
                'Something went wrong while trying to process a georefercing process'
            )
            raise
Ejemplo n.º 3
0
 def testCreateGCPs(self):
     print 'Test clip raster with shapfile function ...'
     clipparameters = '985.27322387696:8628.600769043,7056.9926300049:8619.2794799805,7043.318145752:2149.7222900391,969.47880554199:2167.4909973145'
     boundingbox = BoundingBox(20.9999980926514, 55.7999992370605, 21.1666679382324, 55.9000015258789, 4314)
     response = createGCPs(clipparameters, boundingbox.getCornerPointsAsList(), 9498)
     for gcp in response:
         print gcp
     self.assertTrue(isinstance(response, list), 'Response is not like expected.')
     print '=============='  
Ejemplo n.º 4
0
 def testCreateGCPs(self):
     print 'Test clip raster with shapfile function ...'
     clipparameters = '985.27322387696:8628.600769043,7056.9926300049:8619.2794799805,7043.318145752:2149.7222900391,969.47880554199:2167.4909973145'
     boundingbox = BoundingBox(20.9999980926514, 55.7999992370605,
                               21.1666679382324, 55.9000015258789, 4314)
     response = createGCPs(clipparameters,
                           boundingbox.getCornerPointsAsList(), 9498)
     for gcp in response:
         print gcp
     self.assertTrue(isinstance(response, list),
                     'Response is not like expected.')
     print '=============='
Ejemplo n.º 5
0
    def __runStableGeoreferencing__(self, georefObject, messtischblatt, tmpDir, destPath):    
        try:
            # create a shapefile which represents the boundingbox of the messtischblatt and is latery used for clipping
            shpPath = messtischblatt.BoundingBoxObj.asShapefile(os.path.join(tmpDir,"shape"))
            gcps = createGCPs(georefObject.clipparameter, messtischblatt.BoundingBoxObj.getCornerPointsAsList(), messtischblatt.zoomify_height)
            georeference_result_file = georeference(messtischblatt.original_path, destPath, tmpDir, gcps, DATABASE_SRID, DATABASE_SRID, 'polynom', self.logger, shpPath)        

            # add overviews
            if self.__executeCommands__("gdaladdo --config GDAL_CACHEMAX 500 -r average %s %s"%(georeference_result_file,GEOREFERENCE_OVERVIEW_LEVELS)):
                return destPath
            else:
                raise GeoreferenceProcessRunningError('Something went wrong while trying to process a georefercing process')
        except:
            self.logger.error('Something went wrong while trying to process a georefercing process')
            raise
Ejemplo n.º 6
0
 def __runFastGeoreferencing__(self, georefObject, messtischblatt, tmpDir,
                               destPath):
     try:
         gcps = createGCPs(
             georefObject.clipparameter,
             messtischblatt.BoundingBoxObj.getCornerPointsAsList(),
             messtischblatt.zoomify_height)
         return georeference(messtischblatt.original_path, destPath, tmpDir,
                             gcps, DATABASE_SRID, DATABASE_SRID, 'polynom',
                             self.logger)
     except:
         self.logger.error(
             'Something went wrong while trying to process a fast georefercing process'
         )
         raise