def AdviseRead(self, nXOff, nYOff, nXSize, nYSize, nBufXSize=None, nBufYSize=None, eDT=None, BandMap=None, options=[]): if BandMap is None: BandMap = range(1, self.RasterCount + 1) if eDT is None: eDT = self._band[0].DataType if nBufXSize is None: nBufXSize = nXSize if nBufYSize is None: nBufYSize = nYSize IntBandMap = _gdal.ptrcreate('int', 0, len(BandMap)) for i in range(len(BandMap)): _gdal.ptrset(IntBandMap, BandMap[i], i) sl_options = _gdal.ListToStringList(options) result = _gdal.GDALDatasetAdviseRead(self._o, nXOff, nYOff, nXSize, nYSize, nBufXSize, nBufYSize, eDT, len(BandMap), IntBandMap, sl_options) _gdal.CSLDestroy(sl_options) _gdal.ptrfree(IntBandMap) return result
def AdviseRead( self, nXOff, nYOff, nXSize, nYSize, nBufXSize = None, nBufYSize = None, eDT = None, BandMap = None, options = [] ): if BandMap is None: BandMap = range(1,self.RasterCount+1) if eDT is None: eDT = self._band[0].DataType if nBufXSize is None: nBufXSize = nXSize if nBufYSize is None: nBufYSize = nYSize IntBandMap = _gdal.ptrcreate('int',0,len(BandMap)) for i in range(len(BandMap)): _gdal.ptrset( IntBandMap, BandMap[i], i ) sl_options = _gdal.ListToStringList( options ) result = _gdal.GDALDatasetAdviseRead( self._o, nXOff, nYOff, nXSize, nYSize, nBufXSize, nBufYSize, eDT, len(BandMap), IntBandMap, sl_options ) _gdal.CSLDestroy( sl_options ) _gdal.ptrfree( IntBandMap ) return result
def SetGeoTransform(self,transform): c_transform = _gdal.ptrcreate('double',0,6) for i in range(6): _gdal.ptrset( c_transform, transform[i], i ); err = _gdal.GDALSetGeoTransform(self._o,c_transform) _gdal.ptrfree( c_transform ) return err
def SetGeoTransform(self, transform): c_transform = _gdal.ptrcreate('double', 0, 6) for i in range(6): _gdal.ptrset(c_transform, transform[i], i) err = _gdal.GDALSetGeoTransform(self._o, c_transform) _gdal.ptrfree(c_transform) return err
def SetDefaultHistogram( self, min, max, histogram ): count = len(histogram) hist_array = ptrcreate( 'int', 0, count) for i in range(count): ptrset( hist_array, histogram[i], i ) result = _gdal.GDALSetDefaultHistogram( self._o, min, max, count, hist_array ) ptrfree( hist_array ) return result
def SetDefaultHistogram(self, min, max, histogram): count = len(histogram) hist_array = ptrcreate('int', 0, count) for i in range(count): ptrset(hist_array, histogram[i], i) result = _gdal.GDALSetDefaultHistogram(self._o, min, max, count, hist_array) ptrfree(hist_array) return result
def ToNULLableString(x): if x is None or x == 'NULL': return 'NULL' else: l = len(x) p = ptrcreate( 'char', '', l+1 ) for i in range(l): ptrset( p, x[i], i ) ptrset( p, chr(0), l ) return ptrcast(p,'NULLableString')
def SetColorEntry( self, i, color ): entry = ptrcreate( 'short', 0, 4 ) for j in range(4): if j >= len(color): ptrset( entry, 255, j ) else: ptrset( entry, int(color[j]), j ) res = _gdal.GDALSetColorEntry( self._o, i, ptrcast(entry,'GDALColorEntry_p') ) ptrfree( entry ) return res
def ToNULLableString(x): if x is None or x == 'NULL': return 'NULL' else: l = len(x) p = ptrcreate('char', '', l + 1) for i in range(l): ptrset(p, x[i], i) ptrset(p, chr(0), l) return ptrcast(p, 'NULLableString')
def SetColorEntry(self, i, color): entry = ptrcreate('short', 0, 4) for j in range(4): if j >= len(color): ptrset(entry, 255, j) else: ptrset(entry, int(color[j]), j) res = _gdal.GDALSetColorEntry(self._o, i, ptrcast(entry, 'GDALColorEntry_p')) ptrfree(entry) return res