[gdal-dev] adding GCPs to RSAT-2 NITF format imagery_HH.ntf

Even Rouault even.rouault at mines-paris.org
Tue Jun 9 15:53:19 EDT 2009


You can't. The NITF driver doesn't support setting GCPs in the imagery itself.
When it reports GCPs while reading a NITF file, it takes them from the IGEOLO 
record that can contain up to 4 GCPs. But AFAIK, it wouldn't be easy to *set* 
arbitrary GCPs, as there must be necessary the 4 corners of the image.

Le Tuesday 09 June 2009 21:38:44 Gong, Shawn (Contractor), vous avez écrit :
> hi list,
>
> I have run the following Python codes to add more GCPs to RSAT-2's
> single channel GeoTiff imagery_HH.tif.
> But when I apply it on RSAT-2 NITF format imagery_HH.ntf, all the GCPs
> went to an anxiliary file "imagery_HH_GCPs.ntf.aux.xml".
> How can I add the GCPs directly into imagery_HH.ntf?
>
>
> thanks,
> Shawn
>
>
> ... ...
>     dest_ds = gdal.GetDriverByName("NITF").CreateCopy(dest_file,
> source_DN_ds, 0)
>
>     # get projection
>     projection = source_GCP_ds.GetGCPProjection()
>     if projection is None:
>         projection = source_GCP_ds.GetProjection()
>
>     # get GCPs
>     gcplist = []
>     gcps = source_GCP_ds.GetGCPs()
>     for item in gcps:
>         gcplist.append(item)
>
>     # writing GCPs to dest_ds
>     dest_ds.SetGCPs(gcplist, projection)
>
>     # close datasets properly and flush dest_ds to disk
>     source_GCP_ds.FlushCache()
>     source_GCP_ds = None
>
>     source_DN_ds.FlushCache()
>     source_DN_ds = None
>
>     dest_ds.FlushCache()
>     dest_ds = None




More information about the gdal-dev mailing list