[gdal-dev] Problem with BIL files and GDAL

Daniele Romagnoli daniele.romagnoli at geo-solutions.it
Wed Jul 30 04:58:52 PDT 2014


On Wed, Jul 30, 2014 at 1:23 PM, Belén <beln1 at hotmail.com> wrote:

> Hi again,
> I tried yesterday the option "-ot UInt16" but the result was the same.
>
> This is the result os executing "gdalinfo -stats":
>
>
> Driver: EHdr/ESRI .hdr Labelled
> Files: prueba.bil
>        prueba.hdr
>        prueba.stx
>
> Size is 4000, 4000
> Coordinate System is `'
> Origin = (504815.000000000000000,4766395.000000000000000)
> Pixel Size = (10.000000000000000,-10.000000000000000)
> Corner Coordinates:
> Upper Left  (  504815.000, 4766395.000)
> Lower Left  (  504815.000, 4726395.000)
> Upper Right (  544815.000, 4766395.000)
> Lower Right (  544815.000, 4726395.000)
> Center      (  524815.000, 4746395.000)
> Band 1 Block=4000x1 Type=UInt16, ColorInterp=Undefined
>   Min=87.000 Max=263.000
>   Minimum=87.000, Maximum=263.000, Mean=220.726, StdDev=23.721
>
> You gave me a great idea, I think PNG supports UInt16 but I'v tried using
> -ot BYTE  and it works.
> Thanks you very very much for your help. You saved my life!!
>

Cool!
Note that using -ot BYTE without some scaling may truncate your values: max
= 263 which is greater than 255 (the max byte you can represent)

Cheers,
Daniele

>
> Regards.
> Belén Muñoz.
>
> ------------------------------
> From: daniele.romagnoli at geo-solutions.it
> Date: Wed, 30 Jul 2014 12:58:44 +0200
>
> Subject: Re: [gdal-dev] Problem with BIL files and GDAL
> To: beln1 at hotmail.com
> CC: gdal-dev at lists.osgeo.org
>
> Hi,
> Since we are here, you could re-run gdalinfo -stats on your dataset.
> (Maybe you see a black image due to a dynamic concentrated on low values).
> Moreover you may consider using the "-scale" option on gdal_translate to
> scale your values to byte or make sure to preserve the output type with the
> option "-OT UInt16".
> Honestly, I don't remember if PNG support 16 bits (But would say "yes")
> and if the tool/browser/what else you will use to open it will show you
> correctly.
>
> Hope this helps.
> Regards,
> Daniele
>
> ==
> GeoServer Professional Services from the experts! Visit
> http://goo.gl/NWWaa2 for more information.
> ==
>
> Ing. Daniele Romagnoli
> Senior Software Engineer
>
> GeoSolutions S.A.S.
> Via Poggio alle Viti 1187
> 55054  Massarosa (LU)
> Italy
> phone: +39 0584 962313
> fax:      +39 0584 1660272
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
>
> -------------------------------------------------------
>
>
> On Wed, Jul 30, 2014 at 12:26 PM, Belén <beln1 at hotmail.com> wrote:
>
> Hi Daniele,
> Thank you for your answer.
> This is the output of gdalinfo:
>
> Driver: EHdr/ESRI .hdr Labelled
> Files: prueba.bil
>           prueba.hdr
> Size is 4000, 4000
> Coordinate System is `'
> Origin = (504815.000000000000000,4766395.000000000000000)
> Pixel Size = (10.000000000000000,-10.000000000000000)
> Corner Coordinates:
> Upper Left  (  504815.000, 4766395.000)
> Lower Left  (  504815.000, 4726395.000)
> Upper Right (  544815.000, 4766395.000)
> Lower Right (  544815.000, 4726395.000)
> Center      (  524815.000, 4746395.000)
> Band 1 Block=4000x1 Type=UInt16, ColorInterp=Undefined
>
> Thank you again!!
>
> Regards.
> Belén Muñoz.
>
> ------------------------------
> From: daniele.romagnoli at geo-solutions.it
> Date: Wed, 30 Jul 2014 12:20:09 +0200
> Subject: Re: [gdal-dev] Problem with BIL files and GDAL
> To: beln1 at hotmail.com
> CC: gdal-dev at lists.osgeo.org
>
>
> Hi,
> could you run a gdalinfo on your origin file and provide us the output?
> Wondering if its datatype is float and a straight gdal_translate (without
> scaling applied) truncate all values when going to Byte PNG.
>
> Cheers,
> Daniele
>
> ==
> GeoServer Professional Services from the experts! Visit
> http://goo.gl/NWWaa2 for more information.
> ==
>
> Ing. Daniele Romagnoli
> Senior Software Engineer
>
> GeoSolutions S.A.S.
> Via Poggio alle Viti 1187
> 55054  Massarosa (LU)
> Italy
> phone: +39 0584 962313
> fax:      +39 0584 1660272
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
>
> -------------------------------------------------------
>
>
> On Wed, Jul 30, 2014 at 11:22 AM, Belén <beln1 at hotmail.com> wrote:
>
> Hello!
> My name is Belén and i'm trying to convert a .bil file (.bil and .hdr) to
> a .png using gdal_translate, it seems to work fine, there are no error
> messages but when I open the .png file, I only have a big completely black
> square.
> There's some special thing I should be doing? I'd appreciate any help,
> because I'm completely lost.
>
> Thank you very much in advance.
>
> Regards.
>
> Belén Muñoz.
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140730/061986d4/attachment-0001.html>


More information about the gdal-dev mailing list