[gdal-dev] Can't read NITF image

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] Can't read NITF image

NikosAlexandris
Hi!

I am trying to access an  .ntf  image.

gdalinfo /Some_Path/03APR13WV010500013APR03073140-
P1BS-500060446050_03_P002.ntf -noct -nomd -nogcp -sd 1

ERROR 4: `/vsisubfile/3884_478612158,/Some_Path/03APR13WV010500013APR03073140-
P1BS-500060446050_03_P002.ntf' not recognised as a supported file format.

ERROR 1: Unable to open JPEG2000 image within NITF file.
No JPEG2000 capable driver (JP2KAK, JP2ECW, JP2MRSID, JP2OPENJPEG, etc...) is
available.
You can define the NITF_OPEN_UNDERLYING_DS configuration option to NO, in order
to just get the metadata.
gdalinfo failed - unable to open '/Some_Path/03APR13WV010500013APR03073140-
P1BS-500060446050_03_P002.ntf'.


Indeed,

gdalinfo --formats | grep JPEG
  JPEG (rwv): JPEG JFIF

there is no JPEG2000 support (working in Funtoo, gdal installed via portage, I
think this: <http://gpo.zugaina.org/AJAX/Ebuild/2502482/View>)


Setting

export NITF_OPEN_UNDERLYING_DS=NO

let's me read the metadata.


Is this a *generic* problem or else, if I compile  --with-jasper  support will
allow for reading this image?  And, subsequently, import via r.in.gdal in
GRASS-GIS?

Thank you, Nikos
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't read NITF image

Even Rouault
Le dimanche 07 juillet 2013 21:41:14, Nikos Alexandris a écrit :

> Hi!
>
> I am trying to access an  .ntf  image.
>
> gdalinfo /Some_Path/03APR13WV010500013APR03073140-
> P1BS-500060446050_03_P002.ntf -noct -nomd -nogcp -sd 1
>
> ERROR 4:
> `/vsisubfile/3884_478612158,/Some_Path/03APR13WV010500013APR03073140-
> P1BS-500060446050_03_P002.ntf' not recognised as a supported file format.
>
> ERROR 1: Unable to open JPEG2000 image within NITF file.
> No JPEG2000 capable driver (JP2KAK, JP2ECW, JP2MRSID, JP2OPENJPEG, etc...)
> is available.
> You can define the NITF_OPEN_UNDERLYING_DS configuration option to NO, in
> order to just get the metadata.
> gdalinfo failed - unable to open '/Some_Path/03APR13WV010500013APR03073140-
> P1BS-500060446050_03_P002.ntf'.
>
[...]
> Is this a *generic* problem or else, if I compile  --with-jasper  support
> will allow for reading this image?

This is a problem you'll run into each time you will open a NITF image whose
imagery is compressed as a JPEG2000 codestream. Compiling --with-jasper might
help, but if your image is big, it might not work since jasper reads the whole
image into memory. If you run into this memory problem, you might use OpenJPEG
2 instead (provided you use GDAL 1.10), or else one of the proprietary
implementation.

> And, subsequently, import viar.in.gdal in GRASS-GIS?

If gdalinfo can open it, then it should work with r.in.gdal.

>
> Thank you, Nikos
> _______________________________________________
> gdal-dev mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

--
Geospatial professional services
http://even.rouault.free.fr/services.html
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't read NITF image

NikosAlexandris
Nikos Alexandris a écrit :

> > I am trying to access an  .ntf  image.

> > gdalinfo /Some_Path/03APR13WV010500013APR03073140-
> > P1BS-500060446050_03_P002.ntf -noct -nomd -nogcp -sd 1

> > ERROR 4:
> > `/vsisubfile/3884_478612158,/Some_Path/03APR13WV010500013APR03073140-
> > P1BS-500060446050_03_P002.ntf' not recognised as a supported file format.

[..]

> > Is this a *generic* problem or else, if I compile  --with-jasper  support
> > will allow for reading this image?


Even Rouault wrote:

> This is a problem you'll run into each time you will open a NITF image whose
> imagery is compressed as a JPEG2000 codestream. Compiling --with-jasper
> might help, but if your image is big, it might not work since jasper reads
> the whole image into memory. If you run into this memory problem, you might
> use OpenJPEG 2 instead (provided you use GDAL 1.10),

O-K, looks much better now:

gdalinfo --version && gdalinfo --formats | grep JP
                                     
GDAL 1.10.0, released 2013/04/24                                                                        
  JPEG (rwv): JPEG JFIF
  JP2OpenJPEG (rwv): JPEG-2000 driver based on OpenJPEG library
  JPEG2000 (rwv): JPEG-2000 part 1 (ISO/IEC 15444-1)


e.g.

gdalinfo -nogcp -nomd -noct 03APR13WV010500013APR03073140-
P1BS-500060446050_03_P002.ntf

Driver: NITF/National Imagery Transmission Format
Files: 03APR13WV010500013APR03073140-P1BS-500060446050_03_P002.ntf
Size is 35840, 27648
Coordinate System is `'
Subdatasets:
  SUBDATASET_1_NAME=NITF_IM:0:03APR13WV010500013APR03073140-
P1BS-500060446050_03_P002.ntf
  SUBDATASET_1_DESC=Image 1 of 03APR13WV010500013APR03073140-
P1BS-500060446050_03_P002.ntf

[..]

Corner Coordinates:

[..]

Band 1 Block=1024x1024 Type=UInt16, ColorInterp=Gray
  Overviews: 17920x13824, 8960x6912, 4480x3456, 2240x1728, 1120x864
  Overviews: arbitrary
Warning 1: Unable to save auxilary information in
/vsisubfile/3884_478612158,03APR13WV010500013APR03073140-
P1BS-500060446050_03_P002.ntf.aux.xml.

[more Warnings]


Question:  how can I tell which driver is used?  Just empirically, e.g. Jasper
precedes OpenJPEG2?  Oh well, I'll have to search in the manuals I guess...



> or else one of the proprietary implementation.

I've been through posts in the list and reading details in

<http://trac.osgeo.org/gdal/wiki/ECW>,
<http://trac.osgeo.org/gdal/wiki/JasPer>,
<http://trac.osgeo.org/gdal/wiki/JP2KAK>,
<http://trac.osgeo.org/gdal/wiki/MrSID>

So, what's the take-home message for an average QGIS user for example?  I am
not critisising -- just being curious, honestly.


Milles Mercis Even,
Nikos
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't read NITF image

NikosAlexandris
Nikos Alexandris wrote:

> Question:  how can I tell which driver is used?  Just empirically, e.g.
> Jasper precedes OpenJPEG2?  Oh well, I'll have to search in the manuals I
> guess...

gdalinfo --formats | grep JP

  JPEG (rwv): JPEG JFIF
  JP2OpenJPEG (rwv): JPEG-2000 driver based on OpenJPEG library
  JPEG2000 (rwv): JPEG-2000 part 1 (ISO/IEC 15444-1)


According to <http://trac.osgeo.org/gdal/wiki/ConfigOptions>, GDAL_SKIP:

export GDAL_SKIP="JPEG JPEG2000" && gdalinfo --formats | grep JP

JP2OpenJPEG (rwv): JPEG-2000 driver based on OpenJPEG library


Nice!  Thanks, Nikos
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't read NITF image

NikosAlexandris
All works fine.  A quick one-liner example to get the image(s):

for INPUT in `gdalinfo 03APR13WV010500013APR03073140-
P1BS-500060446050_03_P002.ntf | grep SUBDATASET_ | grep NAME | cut -d":" -f3`;
do gdalwarp -s_srs 'epsg:4326' -t_srs 'epsg:4326' "${INPUT}" "${INPUT}.tif";
done

Are there smarter ways to do that?

Thanks, Nikos
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev