Solved

Reprojecting raster tiles, output doubles in size


Badge +3

Hi,

 

I have a set of 250 raster tiles, I have reprojected them from ITM to WGS84, before reprojection each tile was 87,215KB. After reprojection the tiles are roughly 180,000KB. Why has this happened? My workbench is included here, I first mosaicked the tiles then reprojected and finally clipped back to the tile boundaries.

Thanks for any help.

 

B

icon

Best answer by takashi 13 March 2019, 09:54

View original

26 replies

Userlevel 2
Badge +17

A possible reason is that the source raster data is compressed whereas the destination raster data is not compressed.

Check if the source raster data is compressed with some method. You can see the compression method in the Feature Information window of FME Data Inspector, if it was compressed.

e.g.

Badge +3

A possible reason is that the source raster data is compressed whereas the destination raster data is not compressed.

Check if the source raster data is compressed with some method. You can see the compression method in the Feature Information window of FME Data Inspector, if it was compressed.

e.g.

Hi Takashi,

 

Thanks for the help, the original does not appear to be compressed. See below. Would there be a stretch applied going to wgs84 that would cause the data to increase in size?

 

Thanks

B

 

 

Userlevel 2
Badge +17

A possible reason is that the source raster data is compressed whereas the destination raster data is not compressed.

Check if the source raster data is compressed with some method. You can see the compression method in the Feature Information window of FME Data Inspector, if it was compressed.

e.g.

hmm, I cannot find any other reason.

Could you please post a screenshot of Feature Information about the resulting raster too? There could be a hint.

Badge +3

hmm, I cannot find any other reason.

Could you please post a screenshot of Feature Information about the resulting raster too? There could be a hint.

Should have done that the first time. Thanks for the help.

Userlevel 2
Badge +17

hmm, I cannot find any other reason.

Could you please post a screenshot of Feature Information about the resulting raster too? There could be a hint.

The raster interpretation has changed. Original was UINT8 but the result is UINT16. I think it's the direct reason why the file size increased approximately double.

Userlevel 2
Badge +17

hmm, I cannot find any other reason.

Could you please post a screenshot of Feature Information about the resulting raster too? There could be a hint.

Try inserting the RasterPaletteResolver before the RasterMosaicker, and the RasterPaletteGenerator (Palette Key Interpretation Type: UInt8) before the destination writer feature type.

Badge +3

Try inserting the RasterPaletteResolver before the RasterMosaicker, and the RasterPaletteGenerator (Palette Key Interpretation Type: UInt8) before the destination writer feature type.

Great stuff, thanks for the help. I will post the results when I get them.

Badge +3

Try inserting the RasterPaletteResolver before the RasterMosaicker, and the RasterPaletteGenerator (Palette Key Interpretation Type: UInt8) before the destination writer feature type.

Hi Takashi, I've started the process again and the output is much closer to the original size. Thanks for the great help.

Badge +3

@takashi, sorry to open this up again, I have encountered a problem with the output file. The reprojection has caused the tiles to have black edges.

I initially mosaicked the raster tiles together to try and avoid this and it worked with the larger output tiles, but since including the RasterPaletteResolver and the RasterPaletteGenerator I now have black edges and tiles that don't fit together. Please see image below.

Thanks

B

Userlevel 2
Badge +17

@takashi, sorry to open this up again, I have encountered a problem with the output file. The reprojection has caused the tiles to have black edges.

I initially mosaicked the raster tiles together to try and avoid this and it worked with the larger output tiles, but since including the RasterPaletteResolver and the RasterPaletteGenerator I now have black edges and tiles that don't fit together. Please see image below.

Thanks

B

If you can treat every pure black (0, 0, 0) cell as Nodata, set 0 to the Nodata with the RasterBandNodataSetter before the RasterMosaicker.

Badge +3

If you can treat every pure black (0, 0, 0) cell as Nodata, set 0 to the Nodata with the RasterBandNodataSetter before the RasterMosaicker.

Thanks for the help. I tried this and the output came out the same. Seems strange.

Userlevel 2
Badge +17

@takashi, sorry to open this up again, I have encountered a problem with the output file. The reprojection has caused the tiles to have black edges.

I initially mosaicked the raster tiles together to try and avoid this and it worked with the larger output tiles, but since including the RasterPaletteResolver and the RasterPaletteGenerator I now have black edges and tiles that don't fit together. Please see image below.

Thanks

B

Well, how about setting Maximum to the Overlapping Values parameter in the RasterMosaicker?

Badge +3

Well, how about setting Maximum to the Overlapping Values parameter in the RasterMosaicker?

I am running this now, out of interest would you know why adding the two RasterPalette transformers has brought back the black outline?

Thanks for your help. I appreciate it.

Userlevel 2
Badge +17

@takashi, sorry to open this up again, I have encountered a problem with the output file. The reprojection has caused the tiles to have black edges.

I initially mosaicked the raster tiles together to try and avoid this and it worked with the larger output tiles, but since including the RasterPaletteResolver and the RasterPaletteGenerator I now have black edges and tiles that don't fit together. Please see image below.

Thanks

B

I guess that the black edges have been brought by reprojection, rather than the palette operations.

Badge +3

I guess that the black edges have been brought by reprojection, rather than the palette operations.

But when I undertook this same process initially, there were no black edges (just the file sizes doubling). It was since the introduction of the palette operations the black edges appeared.

Userlevel 2
Badge +17

@takashi, sorry to open this up again, I have encountered a problem with the output file. The reprojection has caused the tiles to have black edges.

I initially mosaicked the raster tiles together to try and avoid this and it worked with the larger output tiles, but since including the RasterPaletteResolver and the RasterPaletteGenerator I now have black edges and tiles that don't fit together. Please see image below.

Thanks

B

Possibly reprojection caused Nodata outlines but the original palette definition didn't have the entry for representing the Nodata color.

What happens if you apply the RasterPaletteResolver before reprojection?

Badge +3

I've had the Palette Resolver before reprojection the whole time. I have attached a copy of the workbench below. Thanks

 

DISCOVERY_REPROJECT_NEW_WORKSTATION.fmw

Badge +3

Possibly reprojection caused Nodata outlines but the original palette definition didn't have the entry for representing the Nodata color.

What happens if you apply the RasterPaletteResolver before reprojection?

The Palette resolver has been before the reprojection throughout all the tests. I have attached a copy of the workspace below.

Setting the Overlapping Values to Maximum has not worked either.

DISCOVERY_REPROJECT_NEW_WORKSTATION.fmw

Userlevel 2
Badge +17

I've had the Palette Resolver before reprojection the whole time. I have attached a copy of the workbench below. Thanks

 

DISCOVERY_REPROJECT_NEW_WORKSTATION.fmw

Could you please share two tiff files adjoining each other, which reproduce the situation?

Badge +3

Could you please share two tiff files adjoining each other, which reproduce the situation?

I've uploaded the tiffs to google driver, link below. Thanks B

 

https://drive.google.com/drive/folders/18YosUVEowILL2tFkmC4k7tCLfq7yN0-s?usp=sharing

Badge +3

Could you please share two tiff files adjoining each other, which reproduce the situation?

I have setup the workbench with the RasterBandNoDataSetter just before the writer and it has removed the black data. I've only done it on the sample of the two tiles I sent to you above. I'm going to run a larger area, hopefully the results will be the same. Thanks so much for your help so far. B

Userlevel 2
Badge +17

I've had the Palette Resolver before reprojection the whole time. I have attached a copy of the workbench below. Thanks

 

DISCOVERY_REPROJECT_NEW_WORKSTATION.fmw

Try inserting a RasterBandNodataSetter (Nodata value: 0) between the RasterPaletteResolver and the RaterMosaicker.

Badge +3

Try inserting a RasterBandNodataSetter (Nodata value: 0) between the RasterPaletteResolver and the RaterMosaicker.

I seem to get the best output when I put the rasterbandnodatasetter before the writer. You have been a great help. Thanks B

Badge +3

@takashi Sorry I have another question. When I view the output tiles they look great in inspector/arcmap etc, but looking at them in windows explorer I still have the black tile edges (see below). How come this is occurring, is there a way to remove the black? Thank you very much for the help thus far.

 

Userlevel 2
Badge +17

@takashi Sorry I have another question. When I view the output tiles they look great in inspector/arcmap etc, but looking at them in windows explorer I still have the black tile edges (see below). How come this is occurring, is there a way to remove the black? Thank you very much for the help thus far.

 

It seems that Windows Explorer ignores Nodata definition. It's just a preview anyway, I don't think it would cause any practical issues on using the data.

Reply