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

Alessandro Parma alessandro.parma at geo-solutions.it
Thu Oct 18 01:19:49 PDT 2018


Thanks for your reply,

My bad, probably copy-pasting mistake. I've re-run the commands:

Just to be sure I exported the GDAL_SKIP env var as well:

export GDAL_SKIP=JP2OpenJPEG
gdalinfo --formats
...
  ERS -raster- (rw+v): ERMapper .ers Labelled
  JP2KAK -raster,vector- (rwv): JPEG-2000 (based on Kakadu *v7.10.4*)
  JPIPKAK -raster- (ro): JPIP (based on Kakadu)
  L1B -raster- (rovs): NOAA Polar Orbiter Level 1b Data Set
...
(No JP2OpenJPEG, by the way, I am using Kakadu 7.10.4)

Looks like gdal_translate is producing a 0-filled raster:

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

gdalinfo -stats ./T34WEB_20181015T104021_TCI_10m.jp2.ovr
Driver: GTiff/GeoTIFF
Files: ./T34WEB_20181015T104021_TCI_10m.jp2.ovr
       ./T34WEB_20181015T104021_TCI_10m.jp2.ovr.aux.xml
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
  Min=0.000 Max=0.000
*  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
  Min=0.000 Max=0.000
*  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
  Min=0.000 Max=0.000
*  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

rm -f ./T34WEB_20181015T104021_TCI_10m.jp2.ovr
./T34WEB_20181015T104021_TCI_10m.jp2.ovr.aux.xml

while gdaladdo is producing a good raster:

gdaladdo -ro --config COMPRESS_OVERVIEW JPEG --config PHOTOMETRIC_OVERVIEW
YCBCR --config INTERLEAVE_OVERVIEW PIXEL
./T34WEB_20181015T104021_TCI_10m.jp2 *--config GDAL_SKIP JP2OpenJPEG* 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

Thank you

On Wed, Oct 17, 2018 at 11:16 PM jratike80 <
jukka.rahkonen at maanmittauslaitos.fi> wrote:

> alpa wrote
> > Hi All,
> >
> > ....
> >
> > 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
> > .......
> >
> > 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
>
> Hi,
>
> Did you skip the OpenJPEG driver by setting the environment variable for
> your gdaladdo test? If you didn't you are probably comparing gdal_translate
> with Kakadu driver vs. gdaladdo with OpenJPEG driver.
>
> -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,

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/20181018/5180839c/attachment-0001.html>


More information about the gdal-dev mailing list