Python gdal.AllRegister() Examples

The following are 1 code examples of gdal.AllRegister(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module gdal , or try the search function .
Example #1
Source File: GdalTools_utils.py    From WMF with GNU General Public License v3.0 5 votes vote down vote up
def long2ShortName(self, longName):
            if longName == '':
                return ''

            if longName in self.dict_long2shortName:
                return self.dict_long2shortName[longName]

            # first get the GDAL driver manager
            if gdal.GetDriverCount() == 0:
                gdal.AllRegister()

            shortName = ''

            # for each loaded GDAL driver
            for i in range(gdal.GetDriverCount()):
                driver = gdal.GetDriver(i)
                if driver == None:
                    continue

                # if this is the driver we searched for then return its short name
                if FileFilter.getFilterName(driver.LongName) == longName:
                    shortName = FileFilter.getFilterName(driver.ShortName)
                    self.dict_long2shortName[longName] = shortName
                    break

            return shortName

        # retrieve the raster format short name by using the file name extension