Ticket #2527 (closed defect: worksforme)

Opened 5 years ago

Last modified 4 years ago

Some georeferencing fails for some images from NGA

Reported by: jdfergason Owned by: warmerdam
Priority: normal Milestone:
Component: GDAL_Raster Version: 1.5.0
Severity: normal Keywords:
Cc:

Description (last modified by mloskot) (diff)

In nitfimage.c there is little bit of code that appears to break georeferencing for *SOME* files from NGA. Basically the georeference shows up way off target. Older versions of GDAL (1.3.0 and back) do not have this issue and I tracked the culprit down to bug fix #1750 in nitfimage.c When I remove this bit of code it works just fine for all the files that I have. The code I removed is listed below.

    /* Bug #1750 */
    /* Fix for cjnc/cjncz01/000k1023.jn1 (and similar) from NIMA GNCJNCN CDROM: */
    /* this product is crossing meridian 180deg and the upper and lower right longitudes are negative (<-170) */
    /* while the upper and lower left longitudes are positive (> 170) which causes problems in OpenEV, etc... */
    /* So we are adjusting the upper and lower right longitudes by setting them above +180 */
    if( (psImage->chICORDS == 'G' || psImage->chICORDS == 'D') &&
        (psImage->dfULX > 170 && psImage->dfLLX > 170 && psImage->dfURX < -170 && psImage->dfLRX < -170 &&
         psImage->dfULY > psImage->dfLLY && psImage->dfURY > psImage->dfLRY) )
    {
        psImage->dfURX += 360;
        psImage->dfLRX += 360;
    }

Change History

Changed 5 years ago by rouault

If you hit the special case of that "if", it should mean that you have an image with meridian 180° in the middle of it. The 360 shift to the upper and lower right longitudes is supposed to avoid that they are negative. It is preferable in many applications that they are a bit above 180° rather than negative.

Can you provide more info on the expected georeferencing of your image ?

Changed 5 years ago by rouault

jdfergason, any news on that topic ?

Changed 5 years ago by mloskot

  • description modified (diff)

Changed 4 years ago by warmerdam

  • status changed from new to closed
  • resolution set to worksforme

jdfergason,

I'm closing now for lack of followup. If you can provide more information please just reopen this ticket.

Thanks.

Note: See TracTickets for help on using tickets.