PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ gdt2pt()

raster2pgsql.gdt2pt (   gdt)
Translate GDAL data type to WKT Raster pixel type.

Definition at line 213 of file raster2pgsql.py.

213def gdt2pt(gdt):
214 """Translate GDAL data type to WKT Raster pixel type."""
215 pixtypes = {
216 gdalc.GDT_Byte : { 'name': 'PT_8BUI', 'id': 4 },
217 gdalc.GDT_Int16 : { 'name': 'PT_16BSI', 'id': 5 },
218 gdalc.GDT_UInt16 : { 'name': 'PT_16BUI', 'id': 6 },
219 gdalc.GDT_Int32 : { 'name': 'PT_32BSI', 'id': 7 },
220 gdalc.GDT_UInt32 : { 'name': 'PT_32BUI', 'id': 8 },
221 gdalc.GDT_Float32 : { 'name': 'PT_32BF', 'id': 10 },
222 gdalc.GDT_Float64 : { 'name': 'PT_64BF', 'id': 11 }
223 }
224
225 # XXX: Uncomment these logs to debug types translation
226 #logit('MSG: Input GDAL pixel type: %s (%d)\n' % (gdal.GetDataTypeName(gdt), gdt))
227 #logit('MSG: Output WKTRaster pixel type: %(name)s (%(id)d)\n' % (pixtypes.get(gdt, 13)))
228
229 return pixtypes.get(gdt, 13)
230