Skip to main content
Question

Set ER Mapper ECW writer to have a white background?

  • June 11, 2019
  • 7 replies
  • 62 views

nicholas
Contributor
Forum|alt.badge.img+14

Hello all,

I have several hundred geoTiff tiles that I want to mosaic into a single ecw.

How can I set the background of the ecw to white?

Currently the ecw has a full black background, which is a waste of ink when printing.

My workbench is simple; geotiff reader => raster mosaicker => ecw writer

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

7 replies

sigtill
Supporter
Forum|alt.badge.img+25
  • Supporter
  • June 12, 2019

Hi @nicholas - this article might help you : https://knowledge.safe.com/articles/58374/how-to-convert-geotiff-to-ecw.html

The trick is to add an alphaband (4). Not sure if your geotiff already has that?


nicholas
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • June 19, 2019

No, the geotiffs have just three bands, RGB

What parameters should I set for the RasterBandAdder?

I'm assuming that the ecw writer will convert the alpha band into whitespace? Because ecw has no alpha layer?


nicholas
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • June 19, 2019

What should the cell value be?

 

What should the Nodata value be?

nicholas
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • June 24, 2019

I am slowly working my way towards what I hope is a solution

Use a RasterExtentsCoercer (extents type: data extents) to generate a polygon around the actual data of the raster. Then a DonutHoleExtractor to throw away the small donut holes (pixels with value 0 which happen to match the NoData value)

This gives me a polygon, which I want to use to set the cell values to white outside of the polygon, and keep the cell values as they are, within the polygon. How do I do this?

Note that I want to write an ecw at the end of this process


nicholas
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • June 24, 2019

I think I have worked it out. But I would appreciate someone checking my work.

geotiff2ecw_working_v2.fmw

The main concept is to generate a polygon that I use to clip the raster, with all the pixels outside the polygon being white, and keeping the pixels inside the polygon at their proper values.

RasterExtentsCoercer (extents type: data extents) to get a polygon boundary of the raster data

DonutHoleExtractor to discard the small donut holes where the pixel is pure black (cell value 0)

Dissolver to fix up some errors in the polygons where donut holes persist

AttributeCreator (@Area())to populate polygon features with area

Sorter (area: Numeric Descending) to sort polygons by area descending

Sampler (First N features) to filter just the first (biggest) polygon.


nicholas
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • June 24, 2019

Continuing on, the largest polygon acts as the Clipper for the raster.

Meanwhile (in parallel) the raster is also modified.

RasterBandNodataRemover to make cell value 0 not the Nodata value

RasterBandNodataSetter (Nodata value: 255) to make the new Nodata value 255

This raster become the Clippee of the Clipper

The output (Inside) of the clipper goes to the ECW writer.

By clipping the raster with the polygon, every cell outside the polygon becomes Nodata. And because Nodata is set to 255, this means that Nodata is rendered white in the ECW writer.

The advantage of this method is that individual pixels inside the raster that are pure black (cell value 0) remain pure black in the output, as they are not classified as Nodata.


nicholas
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • June 24, 2019

geotiff2ecw_working_v3.fmwActually, it is better to use an Aggregator after the Dissolver. This results in a single polygon (an aggregate of several polygons) that become the input to the Clipper. This is a better result (and simpler process)

New workbench attached