Thanks Brian.

But this way you rewrite the whole image to disk. It uses lots of disk space 
and takes forever.

I want to avoid that and just get the mask out to a msk file as fast as 
possible.

I don't want to convert my rgba vrt mosaic.

The final objective is to get a msk file I can use with the simple rgb vrt 
mosaic. Then I'll be able to build overviews with jpeg/ycbcr compression which 
I can't do with rgba vrt because of the 4 bands.

For now I have tried 3 ways:

1) use gdal_rasterize to create a mask directly from the mask polygon 
shapefile. Then just edit the rgb vrt mosaic and add a  maskband to it. The 
problem here is gdaladdo does not honor the maskband. This is the fastest way I 
know, pitty it doesn't work in the end.

2) use gdal_translate like you suggested but use -scale to write all 0s in all 
3 bands, and compress with deflate. You get a valid mask and a very, very small 
useless mosaic. This works but takes a while still.

3) use gdal_translate like you suggested but exaggerate the jpeg compression so 
it errors out (jpeg_quality=15). You get an invalid 1kb mosaic and an 
apparently good msk. But it's corrupted in some way. So doesn't work.

I think #1 has potential. If there was a way to somehow turn the tif created by 
gdal_rasterize into a "true" mask file and have it honored by gdaladdo we would 
have a winner.

Maybe there's a way to directly export the alpha band from the rgba vrt mosaic 
to a mks file without writing anything else? That I guess would be the fastest 
way of all.

Duarte

-----Mensagem original-----
De: Brian Case [mailto:[email protected]] 
Enviada: quinta-feira, 6 de Fevereiro de 2014 21:51
Para: Duarte Carreira
Cc: [email protected]
Assunto: Re: [gdal-dev] how to create just the msk file from a rgba vrt file

Duarte


gdaltranslate -of outfrmt -b 1 -b 2 -b 3 -mask 4 infile outfile 

brian

you can output to vrt's
just dont try to mosaic masked or aphad files with vrts

brian

On Thu, 2014-02-06 at 13:20 +0000, Duarte Carreira wrote:
> Hi there.
> 
>  
> 
> Continuing with trying to cut processing times, I am trying to get a 
> msk file from a vrt mosaic, without converting the entire vrt to tif 
> just to get the msk file.
> 
>  
> 
> In other words, how can we create a msk file from the alpha band 
> without rewriting the whole image?
> 
>  
> 
> Thanks again.
> 
> Duarte
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
> 
> 
> 
> Duarte Carreira
> Diretor | Dep. Informação Geográfica e Cartografia
> 
> 
> www.edia.pt
> 
> www.alqueva.com.pt
> Tel. +351 284315100
> 
> 
> 
> 
> _______________________________________________
> gdal-dev mailing list
> [email protected]
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to