[gdal-dev] Creating external overviews for JP2 files?

Alessandro Parma alessandro.parma at geo-solutions.it
Wed Oct 17 09:22:12 PDT 2018


Hi All,

Sorry for hijacking the thread but I had kind of the "opposite" issue,
trying to achieve the same goal (external overviews for JP2 files) using
the JP2KAK driver instead of JP2OpenJPEG. In my case, it looks like I can
only create the overview files directly using gdaladdo, without doing a
gdal_translate first. If I try to do a gdal_translate first I end up with a
0-fileed file. Let me give an example:

I run gdal_translate first as follows:

gdal_translate -outsize 50% 50% -co TILED=YES -co COMPRESS=JPEG -co
PHOTOMETRIC=YCBCR /tmp/T34WEB_20181015T104021_TCI_10m.jp2
~/T34WEB_20181015T104021_TCI_10m.jp2.ovr_geosolutions_jkak --config
GDAL_SKIP JP2OpenJPEG

Then compute stats on the file with gdalinfo -stats and I get the following:

gdalinfo -stats T34WEB_20181015T104021_TCI_10m.jp2.ovr_geosolutions_jkak

Driver: GTiff/GeoTIFF
Files: T34WEB_20181015T104021_TCI_10m.jp2.ovr_geosolutions_jkak
Size is 5490, 5490
Coordinate System is:
PROJCS["WGS 84 / UTM zone 34N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",21],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["Easting",EAST],
    AXIS["Northing",NORTH],
    AUTHORITY["EPSG","32634"]]
Origin = (499980.000000000000000,7700040.000000000000000)
Pixel Size = (20.000000000000000,-20.000000000000000)
Metadata:
  AREA_OR_POINT=Area
  Corder=LRCP
Image Structure Metadata:
  COMPRESSION=YCbCr JPEG
  INTERLEAVE=PIXEL
  SOURCE_COLOR_SPACE=YCbCr
Corner Coordinates:
Upper Left  (  499980.000, 7700040.000) ( 20d59'58.17"E, 69d24'34.71"N)
Lower Left  (  499980.000, 7590240.000) ( 20d59'58.25"E, 68d25'29.70"N)
Upper Right (  609780.000, 7700040.000) ( 23d47'41.77"E, 69d23'13.78"N)
Lower Right (  609780.000, 7590240.000) ( 23d40'24.01"E, 68d24'12.80"N)
Center      (  554880.000, 7645140.000) ( 22d22' 0.55"E, 68d54'42.54"N)
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
*  Minimum=0.000, Maximum=0.000, Mean=0.000, StdDev=0.000*
  Metadata:
    STATISTICS_MAXIMUM=0
    STATISTICS_MEAN=0
    STATISTICS_MINIMUM=0
    STATISTICS_STDDEV=0
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
*  Minimum=0.000, Maximum=0.000, Mean=0.000, StdDev=0.000*
  Metadata:
    STATISTICS_MAXIMUM=0
    STATISTICS_MEAN=0
    STATISTICS_MINIMUM=0
    STATISTICS_STDDEV=0
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
*  Minimum=0.000, Maximum=0.000, Mean=0.000, StdDev=0.000*
  Metadata:
    STATISTICS_MAXIMUM=0
    STATISTICS_MEAN=0
    STATISTICS_MINIMUM=0
    STATISTICS_STDDEV=0


If I produce the overview file "on the fly" with gdaladdo I get a good
overview file instead:

gdaladdo -ro --config COMPRESS_OVERVIEW JPEG --config PHOTOMETRIC_OVERVIEW
YCBCR --config
INTERLEAVE_OVERVIEW PIXEL  T34WEB_20181015T104021_TCI_10m.jp2 2 4 8 16 32
64 128

gdalinfo -stats  ./T34WEB_20181015T104021_TCI_10m.jp2.ovr
Driver: GTiff/GeoTIFF
Files: ./T34WEB_20181015T104021_TCI_10m.jp2.ovr
Size is 5490, 5490
Coordinate System is `'
Image Structure Metadata:
  COMPRESSION=YCbCr JPEG
  INTERLEAVE=PIXEL
  SOURCE_COLOR_SPACE=YCbCr
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0, 5490.0)
Upper Right ( 5490.0,    0.0)
Lower Right ( 5490.0, 5490.0)
Center      ( 2745.0, 2745.0)
Band 1 Block=128x128 Type=Byte, ColorInterp=Red
*  Minimum=0.000, Maximum=255.000, Mean=71.229, StdDev=62.445*
  Overviews: 2745x2745, 1373x1373, 687x687, 344x344, 172x172, 86x86
  Metadata:
    STATISTICS_MAXIMUM=255
    STATISTICS_MEAN=71.229008132023
    STATISTICS_MINIMUM=0
    STATISTICS_STDDEV=62.445099566295
Band 2 Block=128x128 Type=Byte, ColorInterp=Green
*  Minimum=0.000, Maximum=255.000, Mean=66.111, StdDev=62.790*
  Overviews: 2745x2745, 1373x1373, 687x687, 344x344, 172x172, 86x86
  Metadata:
    STATISTICS_MAXIMUM=255
    STATISTICS_MEAN=66.110971363731
    STATISTICS_MINIMUM=0
    STATISTICS_STDDEV=62.790298201369
Band 3 Block=128x128 Type=Byte, ColorInterp=Blue
*  Minimum=0.000, Maximum=255.000, Mean=67.561, StdDev=63.721*
  Overviews: 2745x2745, 1373x1373, 687x687, 344x344, 172x172, 86x86
  Metadata:
    STATISTICS_MAXIMUM=255
    STATISTICS_MEAN=67.560742897336
    STATISTICS_MINIMUM=0
    STATISTICS_STDDEV=63.721118995755

Any idea on what is causing this? I am using GDAL version 2.2.4

Thank you in advance

On Wed, Oct 17, 2018 at 11:53 AM Daniele Romagnoli <
daniele.romagnoli at geo-solutions.it> wrote:

>
>
> ---------- Forwarded message ---------
> From: jratike80 <jukka.rahkonen at maanmittauslaitos.fi>
> Date: Mon, Oct 8, 2018 at 1:08 PM
> Subject: Re: [gdal-dev] Creating external overviews for JP2 files?
> To: <gdal-dev at lists.osgeo.org>
>
>
> Hi Andrea,
>
> I had a try and it works for me with the gisinternals build "GDAL 2.4.0dev"
> with JP2OpenJPEG driver
>
> gdaladdo -ro --config COMPRESS_OVERVIEW JPEG --config PHOTOMETRIC_OVERVIEW
> YCBCR --conf
> ig INTERLEAVE_OVERVIEW PIXEL  ovr.jp2 2 4 8 16 32
> 0...10...20...30...40...50...60...70...80...90...100 - done.
>
>
> -Jukka Rahkonen-
>
>
>
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
> --
> Regards,
> Daniele Romagnoli
> ==
> GeoServer Professional Services from the experts! Visit
> http://goo.gl/it488V for more information.
> ==
>
> Ing. Daniele Romagnoli
> Senior Software Engineer
>
> GeoSolutions S.A.S.
> Via di Montramito 3/A
> 55054  Massarosa (LU)
> Italy
> phone: +39 0584 962313
> fax:      +39 0584 1660272
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
>
> -------------------------------------------------------
>
> Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE
> 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si
> precisa che ogni circostanza inerente alla presente email (il suo
> contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è
> riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il
> messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra
> operazione è illecita. Le sarei comunque grato se potesse darmene notizia.
>
> This email is intended only for the person or entity to which it is
> addressed and may contain information that is privileged, confidential or
> otherwise protected from disclosure. We remind that - as provided by
> European Regulation 2016/679 “GDPR” - copying, dissemination or use of this
> e-mail or the information herein by anyone other than the intended
> recipient is prohibited. If you have received this email by mistake, please
> notify us immediately by telephone or e-mail.
>


-- 

Regards,

Alessandro Parma

==
GeoServer Professional Services from the experts! Visit http://goo.gl/it488V
for more information.
==

Alessandro Parma
DevOps Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE
2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si
precisa che ogni circostanza inerente alla presente email (il suo
contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è
riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il
messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra
operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is
addressed and may contain information that is privileged, confidential or
otherwise protected from disclosure. We remind that - as provided by
European Regulation 2016/679 “GDPR” - copying, dissemination or use of this
e-mail or the information herein by anyone other than the intended
recipient is prohibited. If you have received this email by mistake, please
notify us immediately by telephone or e-mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20181017/aa8b3cdf/attachment-0001.html>


More information about the gdal-dev mailing list