6

Any ideas on how to force a 1bit raster output in ArcGIS 10.1? By default, ArcGIS is being very dense about recognizing pixel depth. I have a binary raster [0,1] and a mask raster [1] and they are being written as 32bit. Because of this they are ~10GB rather than ~32MB.

The raster dimensions are row=51836, col=53276 at 30m. I am outputting an "img" format. I tried writing into a filegeodatabase and it outputs 8bit. However, when I try to convert the filegeodatabase raster into a img format it produces a garbage raster (scrambled pixels representing only part of the image). In the arguments for the "convert raster to different format" (ArcCatalog context menu), I am specifying 1 bit and removing the default NoData value or setting it to a 0 background value. The resulting rasters are either still 32bit or garbage.

When originally creating the rasters, I am wrapping my raster calculator statement in Int() but am still getting 32bit, which should not be possible. I could imagine 8bit output, but 32bit is nonsensical for integer and is normally assigned to floating point. I do have my geoprocessing environment defined and am working in an Albers projection.

  • Has there been any traction on this over the last few years, or are we stuck with whichever bit depth the software chooses for us? It would be nice to omit the "Copy Raster" step in workflows. – Aaron Mar 22 '18 at 19:24
6

I just did some basic tests, converting a raster to a binary mask by performing a Con, which created an 8-bit output. From there, I could use Copy Raster to convert the output to a 1-bit raster:

arcpy.CopyRaster_management("in_raster", "C:/workspace/foo.img", "", "", "", "", "", "1_BIT")

I confirmed that ArcGIS and GDAL both see this as a 1-bit raster. For other formats, 1-bit output may not be possible, the limitations for each format are listed on the supported raster formats page.

If you are really pushing for the smallest possible files, there are even some other tricks you can use:

  • If you can, you'll be better off using GeoTIFF, which supports more settings, and will produce files ~30% smaller than the equivalent Erdas Image file.
  • Disable Pyramids, with:

    arcpy.env.pyramid = "0"
    
  • Make sure that you're using an appropriate compression setting arcpy.env.compression for the output raster. LZW is a good default, but if you are working with 1-bit rasters, you can push things even further with the CCITT family of compression algorithms, originally designed for Fax machines. You can set this with:

    arcpy.env.compression = "CCITT_1D"
    

The two environment settings I mentioned here can also be added to the environment of the geoprocessing tools, under "Environment > Raster Storage".

If none of this works for you, would you be able to share a piece of your data for us to test against?

1

I suggest that you try with the copy raster tool (management). You can specify the pixel depth as one of the parameters.

EDIT : I would also try to store it in a bmp format instead of .img

  • 1
    This is one of the things that I have already tried. When you right click on a raster in ArcCatalog and select "Export > Converter Raster to a Different Format..." it brings up the copy raster tool. – Jeffrey Evans Feb 6 '14 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.