Thank you for the quick, helpful response.  Sounds like I need to dig into the 
NITF spec to determine how to best use the available precision.  Thanks again.

From: Even Rouault <even.roua...@spatialys.com>
Sent: Thursday, July 20, 2023 11:45 AM
To: Nigus, Steve <steve.ni...@flightsafety.com>; gdal-dev@lists.osgeo.org
Subject: Re: [gdal-dev] NITF geotransform data erratic

CAUTION EXTERNAL EMAIL: Verify sender, links, and attachments are safe before 
taking action.



NITF base georeferencing using the IGEOLO field sucks because there's not 
enough decimal digits to compute the full accuracy of a geotransform, and thus 
when GDAL tries to reconstruct the geotransform from the 4 corners (that's how 
georeferencing is stored), the threshold to detect if the computed affine 
geotransform isn't always met.

I thought that a workaround would be to write the SDE TREs (GEOPSB/PRJPSB and 
MAPLOB). There's a SDE_TRE=YES creation option for that, but its implementation 
on the writing side is limited to geographic coordinates, not projected ones 
(could potentially be extended). So if you want to go with that route, you'll 
have to compose the content of the TREs by yourself from the NITF spec, which 
is a non trivial exercice. But actually, I'm wrong. MAPLOB cannot capture 
rotating terms of a geotransform.

On the reading side, you can try to set the GDAL_GCPS_TO_GEOTRANSFORM_APPROX_OK 
config option to a value larger than the 0.25 pixel default value. cf 
https://gdal.org/api/raster_c_api.html#_CPPv422GDALGCPsToGeoTransformiPK8GDAL_GCPPdi

Even
Le 20/07/2023 à 18:18, Nigus, Steve a écrit :
I am doing a real-time SAR spot simulation where the SAR orbits a target point 
and saves a series of the georeferenced spot image files.  My initial 
implementation generated non-GDAL GeoTIFF or JPEG files.  I use a least-squares 
algorithm to develop the 6 affine geotransform values.  This all works fine, 
and the files display nicely in my GIS viewer.   I have since brought in GDAL 
2.2.3 to create NITF files.  Unfortunately, over 30% of the NITF files lose the 
geotransform info.  Rather, they show generic GCPs.  The “good” NITF files 
display OK in my GIS viewer.  As a sanity test, I took a series of non-GDAL 
GeoTIFF files and ran them through gdal_translate to NITF.  Interestingly, 
around 30% of the NITF files again dropped the geotransform data.  I’ve 
attached below gdalinfo reports of a gdal_translate input GeoTIFF file and the 
output NITF file for a failing example.  My geotransform data appears to be 
well-behaved.  Question:  What could cause geotransform data to be rejected?  
Thanks…..


Non-GDAL gdal_translate input GeoTIFF file:

$ gdalinfo sar2023071722525322.tif
Driver: GTiff/GeoTIFF
Files: sar2023071722525322.tif
Size is 1024, 1024
Coordinate System is:
PROJCS["VITAL SAR Simulation",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-81],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
GeoTransform =
  586659.1336352756, -0.2027675805429681, -0.2274441341933198
  2969181.096499263, -0.2274441341933198, 0.2027675805429681
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  586659.134, 2969181.096) ( 80d 7'40.06"W, 26d50'29.50"N)
Lower Left  (  586426.231, 2969388.731) ( 80d 7'48.44"W, 26d50'36.30"N)
Upper Right (  586451.500, 2968948.194) ( 80d 7'47.64"W, 26d50'21.98"N)
Lower Right (  586218.597, 2969155.828) ( 80d 7'56.02"W, 26d50'28.78"N)
Center      (  586438.865, 2969168.462) ( 80d 7'48.04"W, 26d50'29.14"N)
Band 1 Block=1024x8 Type=Byte, ColorInterp=Gray

gdal_translate output NITF file:

$ gdalinfo sar2023071722525322.nitf
Driver: NITF/National Imagery Transmission Format
Files: sar2023071722525322.nitf
Size is 1024, 1024
Coordinate System is `'
GCP Projection =
PROJCS["UTM Zone 17, Northern Hemisphere",
    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",-81],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["Meter",1]]
GCP[  0]: Id=UpperLeft, Info=
          (0.5,0.5) -> (586659,2969181,0)
GCP[  1]: Id=UpperRight, Info=
          (1023.5,0.5) -> (586451,2968948,0)
GCP[  2]: Id=LowerRight, Info=
          (1023.5,1023.5) -> (586219,2969156,0)
GCP[  3]: Id=LowerLeft, Info=
          (0.5,1023.5) -> (586426,2969389,0)
Metadata:
  NITF_ABPP=08
  NITF_CCS_COLUMN=0
  NITF_CCS_ROW=0
  NITF_CLEVEL=03
  NITF_ENCRYP=0
  NITF_FBKGC=  0,  0,  0
  NITF_FDT=20021216151629
  NITF_FHDR=NITF02.10
  NITF_FSCATP=
  NITF_FSCAUT=
  NITF_FSCLAS=U
  NITF_FSCLSY=
  NITF_FSCLTX=
  NITF_FSCODE=
  NITF_FSCOP=00000
  NITF_FSCPYS=00000
  NITF_FSCRSN=
  NITF_FSCTLH=
  NITF_FSCTLN=
  NITF_FSDCDT=
  NITF_FSDCTP=
  NITF_FSDCXM=
  NITF_FSDG=
NITF_FSDGDT=
  NITF_FSREL=
  NITF_FSSRDT=
  NITF_FTITLE=
  NITF_IALVL=0
  NITF_IC=NC
  NITF_ICAT=VIS
  NITF_ICORDS=N
  NITF_IDATIM=20021216151629
  NITF_IDLVL=1
  NITF_IGEOLO=175866592969181175864512968948175862192969156175864262969389
  NITF_IID1=Missing
  NITF_IID2=
  NITF_ILOC_COLUMN=0
  NITF_ILOC_ROW=0
  NITF_IMAG=1.0
  NITF_IMODE=B
  NITF_IREP=MONO
  NITF_ISCATP=
  NITF_ISCAUT=
  NITF_ISCLAS=U
  NITF_ISCLSY=
  NITF_ISCLTX=
  NITF_ISCODE=
  NITF_ISCRSN=
  NITF_ISCTLH=
  NITF_ISCTLN=
  NITF_ISDCDT=
  NITF_ISDCTP=
  NITF_ISDCXM=
  NITF_ISDG=
  NITF_ISDGDT=
  NITF_ISORCE=Unknown
  NITF_ISREL=
  NITF_ISSRDT=
  NITF_ONAME=
  NITF_OPHONE=
  NITF_OSTAID=GDAL
  NITF_PJUST=R
  NITF_PVTYPE=INT
  NITF_STYPE=BF01
  NITF_TGTID=
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0, 1024.0)
Upper Right ( 1024.0,    0.0)
Lower Right ( 1024.0, 1024.0)
Center      (  512.0,  512.0)
Band 1 Block=1024x1 Type=Byte, ColorInterp=Gray





_______________________________________________

gdal-dev mailing list

gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org>

https://lists.osgeo.org/mailman/listinfo/gdal-dev

--

http://www.spatialys.com

My software is free, but my time generally not.
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to