Opened 10 years ago

Closed 6 years ago

#5321 closed defect (fixed)

USGSDEM Driver not reading negative zone information correctly

Reported by: smaity Owned by: warmerdam
Priority: normal Milestone: 2.3.0
Component: GDAL_Raster Version: 1.10.1
Severity: normal Keywords: USGSDEM
Cc:

Description

Issue found in GDAL 1.10.0, exists in the latest 1.10.1 also.

Problem: DEM dataset projection with negative UTM zone number, i.e -34, is not properly read by the driver. Calculation for central_meridian is getting wrong.

Debugged GDAL USGSDEM driver code, needs the following fix to be included in the build -

  1. Have the facility to save projection info for south hemisphere
  2. Handle negative zone as positive but treat them as southern hemisphere

Solution: Fix required in the following method -

int USGSDEMDataset::LoadFromFile(VSILFILE *InDem)
{
..
int		bNorth = TRUE;
..
VSIFSeekL(InDem, 156, 0);
    nCoordSystem = ReadInt(InDem);
    iUTMZone = ReadInt(InDem);

	if(iUTMZone < 0)
	{
		iUTMZone *= -1;
		bNorth = FALSE;
	}
...

    if (nCoordSystem == 1)	// UTM
        sr.SetUTM( iUTMZone, bNorth );

...

}

Change History (3)

comment:1 by warmerdam, 10 years ago

Status: newassigned

Hi, do you have a file with a negative zone you could supply to demonstrate the problem?

comment:2 by Jukka Rahkonen, 9 years ago

smaity,

Do you have such a sample file?

comment:3 by Even Rouault, 6 years ago

Milestone: 2.3.0
Resolution: fixed
Status: assignedclosed

Was fixed in GDAL 2.3.0 per https://github.com/OSGeo/gdal/issues/344

Note: See TracTickets for help on using tickets.