当前位置:   article > 正文

Error: pgraster_wkb_reader: grayscale band type 10 unsupported_float32, uint32) is not supported

float32, uint32) is not supported

错误原因:Float32 is not supported for rendering。即栅格数据类型Float32不支持。

cmd中用GDAL查看。在波段中的数据类型是Float32的不支持渲染。
不支持的例子:

C:\Program Files\GDAL>gdalinfo D:\mapnik\mapnik-v2.2.0\shp\mapnik\tmean10_19.tif
Driver: GTiff/GeoTIFF
Files: D:\mapnik\mapnik-v2.2.0\shp\mapnik\tmean10_19.tif
Size is 3600, 3600
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (90.000000000000000,60.000000000000000)
Pixel Size = (0.008333333333333,-0.008333333333333)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  90.0000000,  60.0000000) ( 90d 0' 0.00"E, 60d 0' 0.00"N)
Lower Left  (  90.0000000,  30.0000000) ( 90d 0' 0.00"E, 30d 0' 0.00"N)
Upper Right ( 120.0000000,  60.0000000) (120d 0' 0.00"E, 60d 0' 0.00"N)
Lower Right ( 120.0000000,  30.0000000) (120d 0' 0.00"E, 30d 0' 0.00"N)
Center      ( 105.0000000,  45.0000000) (105d 0' 0.00"E, 45d 0' 0.00"N)
Band 1 Block=3600x1 Type=Float32, ColorInterp=Gray
  NoData Value=-3.3999999521443642e+038
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28

postgres查看:

CONSTRAINT enforce_pixel_types_rast CHECK (_raster_constraint_pixel_types(rast) = '{32BF}'::text[]),
  • 1

支持的例子:

Driver: GTiff/GeoTIFF
Files: D:\mapnik\mapnik-v2.2.0\shp\mapnik\HYP_LR.tif
Size is 16200, 8100
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (-180.000000000000000,90.000000000000000)
Pixel Size = (0.022222222222220,-0.022222222222220)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_DATETIME=2014:10:18 12:08:22
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
  TIFFTAG_SOFTWARE=Adobe Photoshop CC 2014 (Macintosh)
  TIFFTAG_XRESOLUTION=231.429
  TIFFTAG_YRESOLUTION=231.429
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (-180.0000000,  90.0000000) (180d 0' 0.00"W, 90d 0' 0.00"N)
Lower Left  (-180.0000000, -90.0000000) (180d 0' 0.00"W, 90d 0' 0.00"S)
Upper Right ( 180.0000000,  90.0000000) (180d 0' 0.00"E, 90d 0' 0.00"N)
Lower Right ( 180.0000000, -90.0000000) (180d 0' 0.00"E, 90d 0' 0.00"S)
Center      (  -0.0000000,   0.0000000) (  0d 0' 0.00"W,  0d 0' 0.00"N)
Band 1 Block=16200x1 Type=Byte, ColorInterp=Red
Band 2 Block=16200x1 Type=Byte, ColorInterp=Green
Band 3 Block=16200x1 Type=Byte, ColorInterp=Blue
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32

postgres查看:

CONSTRAINT enforce_pixel_types_rast CHECK (_raster_constraint_pixel_types(rast) = '{8BUI,8BUI,8BUI}'::text[]),
  • 1

pgraster插件源码查看/mapnik/plugins/input/pgraster/pgraster_wkb_reader.cpp

switch (pixtype) {
    case PT_1BB:
    case PT_2BUI:
    case PT_4BUI:
      // all <8BPP values are wrote in full bytes anyway
    case PT_8BSI:
      // mapnik does not support signed anyway
    case PT_8BUI:
      return read_grayscale_band(bbox, width_, height_, hasnodata,
                          std::bind(read_uint8, &ptr_));
      break;
    case PT_16BSI:
      // mapnik does not support signed anyway
    case PT_16BUI:
      return read_grayscale_band(bbox, width_, height_, hasnodata,
                          std::bind(read_uint16, &ptr_, endian_));
      break;
    case PT_32BSI:
      // mapnik does not support signed anyway
    case PT_32BUI:
      return read_grayscale_band(bbox, width_, height_, hasnodata,
                          std::bind(read_uint32, &ptr_, endian_));
      break;
    default:
      std::ostringstream err;
      err << "pgraster_wkb_reader: grayscale band type "
          << pixtype << " unsupported";
      //MAPNIK_LOG_WARN(pgraster) << err.str();
      throw mapnik::datasource_exception(err.str());
  }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

这里可以发现支持的格式类型,满足这些类型就行,否则报错。

https://github.com/mapnik/mapnik/issues/3324
https://github.com/systemapic/pile/issues/30

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/329913
推荐阅读
相关标签
  

闽ICP备14008679号