[gdal-dev] Reading a JP2 file - obj_decode() failed
Jonathan Moules
jonathan-lists at lightpear.com
Sun Aug 9 07:30:12 PDT 2020
Hi Even,
Ah, it's comma delimited. I tried spaces.
Here's the response, with with light editing to get rid of duplicate
info (The bands are all the same). Nothing in the output with the string
"tile".
Cheers,
Jonathan
OPENJPEG: info: Start to read j2k main header (0).
OPENJPEG: info: Main header has been correctly decoded.
OPENJPEG: SRGB color space
GDALJP2Metadata: Got projection from GeoJP2 (geotiff) box (0):
PROJCS["British National Grid (ORD SURV GB)",GEOGCS["OSGB
1936",DATUM["OSGB_1936",SPHEROID["Airy1830",6377563.396,299.3249612664951,AUTHORITY["EPSG","7001"]],AUTHORITY["EPSG","6277"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4277"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",49],PARAMETER["central_meridian",-2],PARAMETER["scale_factor",0.9996012717],PARAMETER["false_easting",400000],PARAMETER["false_northing",-100000],UNIT["metre",1,AUTHORITY["EPSG","9001"]]]
MDReaderPleiades: Not a Pleiades product
MDReaderPleiades: Not a Pleiades product
GDAL: GDALOpen(FILENAME.jp2, this=00000000060407F0) succeeds as JP2OpenJPEG.
Driver: JP2OpenJPEG/JPEG-2000 driver based on OpenJPEG library
GDAL: GDALDefaultOverviews::OverviewScan()
Files: FILENAME.jp2
FILENAME.jp2.aux.xml
...
Metadata:
GEOTIFF_CHAR__GeogAngularUnitsGeoKey=Angular_Degree
GEOTIFF_CHAR__GeogEllipsoidGeoKey=Ellipse_Airy_1830
GEOTIFF_CHAR__GeogGeodeticDatumGeoKey=Datum_OSGB_1936
GEOTIFF_CHAR__GeographicTypeGeoKey=GCS_OSGB_1936
GEOTIFF_CHAR__GTModelTypeGeoKey=ModelTypeProjected
GEOTIFF_CHAR__GTRasterTypeGeoKey=RasterPixelIsArea
GEOTIFF_CHAR__ProjCoordTransGeoKey=CT_TransverseMercator
GEOTIFF_CHAR__ProjectedCSTypeGeoKey=User-Defined
GEOTIFF_CHAR__ProjectionGeoKey=User-Defined
GEOTIFF_CHAR__ProjLinearUnitsGeoKey=Linear_Meter
GEOTIFF_NUM__1024__GTModelTypeGeoKey=1
GEOTIFF_NUM__1025__GTRasterTypeGeoKey=1
GEOTIFF_NUM__1026__GTCitationGeoKey=British National Grid (ORD SURV GB)
GEOTIFF_NUM__2048__GeographicTypeGeoKey=4277
GEOTIFF_NUM__2049__GeogCitationGeoKey=OSGB 1936
GEOTIFF_NUM__2050__GeogGeodeticDatumGeoKey=6277
GEOTIFF_NUM__2054__GeogAngularUnitsGeoKey=9102
GEOTIFF_NUM__2056__GeogEllipsoidGeoKey=7001
GEOTIFF_NUM__2057__GeogSemiMajorAxisGeoKey=6377563.396000
GEOTIFF_NUM__2059__GeogInvFlatteningGeoKey=299.324961
GEOTIFF_NUM__3072__ProjectedCSTypeGeoKey=32767
GEOTIFF_NUM__3074__ProjectionGeoKey=32767
GEOTIFF_NUM__3075__ProjCoordTransGeoKey=1
GEOTIFF_NUM__3076__ProjLinearUnitsGeoKey=9001
GEOTIFF_NUM__3080__ProjNatOriginLongGeoKey=-2.000000
GEOTIFF_NUM__3081__ProjNatOriginLatGeoKey=49.000000
GEOTIFF_NUM__3082__ProjFalseEastingGeoKey=400000.000000
GEOTIFF_NUM__3083__ProjFalseNorthingGeoKey=-100000.000000
GEOTIFF_NUM__3092__ProjScaleAtNatOriginGeoKey=0.999601
Image Structure Metadata:
INTERLEAVE=PIXEL
OGRCT: Source: +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717
+x_0=400000 +y_0=
-100000 +datum=OSGB36 +units=m +no_defs
OGRCT: Target: +proj=longlat +datum=OSGB36 +no_defs
Corner Coordinates:
...
Band 1 Block=1024x1024 Type=Byte, ColorInterp=Red
Min=168.000 Max=255.000
Minimum=168.000, Maximum=255.000, Mean=243.359, StdDev=16.164
Overviews: 66000x124000, 33000x62000, 16500x31000, 8250x15500,
4125x7750, 2062
x3875, 1031x1937, 515x968, 257x484, 128x242, 64x121
Overviews: arbitrary
Metadata:
STATISTICS_APPROXIMATE=YES
STATISTICS_MAXIMUM=255
STATISTICS_MEAN=243.35889029004
STATISTICS_MINIMUM=168
STATISTICS_STDDEV=16.164314681862
STATISTICS_VALID_PERCENT=100
Image Structure Metadata:
COMPRESSION=JPEG2000
...
GDAL: GDALClose(FILENAME.jp2,this=00000000060407F0)
On 2020-08-09 15:21, Even Rouault wrote:
>
> On dimanche 9 août 2020 12:47:33 CEST Jonathan Moules wrote:
>
> > Hi Even,
>
> > Thanks for getting back to me. I'm a little rusty with GDAL; it has
>
> > probably been 5+ years since I last used it.
>
> >
>
> > I can confirm my QGIS install version (OSGEO4W) does have the JP2ECW
>
> > driver (`gdalinfo --formats`).
>
> >
>
> > I'm using the Python GDAL build from
>
> > https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal - doesn't say it
>
> > includes JP2ECW. I only have access to that GDAL build via Python but
>
> > haven't managed to figure out what the Python API equivalent of
>
> > "gdalinfo --formats" is (assuming there is one).
>
> >
>
> > I don't seem to be able to force JP2OpenJPEG on the OSGeo4W one.
>
> > gdalinfo --config GDAL_SKIP JP2ECW FILENAME.jp2 = uses the MrSID
> driver
>
> > gdalinfo --config GDAL_SKIP JP2ECW --config GDAL_SKIP JP2MrSID
>
> > FILENAME.jp2 = Goes back to JP2ECW
>
> If you specify several times a configuration option, the last value
> for a given key will override the previous one(s). You can skip
> several drivers by using comma as a separator. And I forgot a very
> important switch for what I had in mind, "--debug on" instead of my
> buggy --format
>
> So try:
>
> gdalinfo --config GDAL_SKIP JP2ECW,JP2MrSID --debug on FILENAME.jp2
>
> > I can't help but notice the block size and overview levels are reporting
>
> > different info compared to the JP2ECW output
>
> Yes, the various JPEG2000 driver have different logic (or
> arbitrariness...) to decide the block size. For the JP2OpenJPEG
> driver, 1024x1024 is either because it is the JPEG2000 tile size or as
> an arbitrary block size for a single tiled image. The --debug on will
> output lower level info.
>
> --
>
> Spatialys - Geospatial professional services
>
> http://www.spatialys.com
>
More information about the gdal-dev
mailing list