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

Gong, Shawn (Contractor) Shawn.Gong at drdc-rddc.gc.ca
Tue Jun 9 15:38:44 EDT 2009


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




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20090609/7fdf94d8/attachment.html


More information about the gdal-dev mailing list