[gdal-dev] Cannot read UTM Ozi .map file

Nik Sands nixanz at nixanz.com
Tue Nov 27 20:16:18 PST 2012


Hi GDAL-dev,

I've recently re-compiled GDAL from the trunk after the patch to fix UTM ozi files was applied.  This has worked well for most UTM files I've tried so far, but I've come across one that produces a strange error in my code, but works OK with gdalinfo.  The following code fails for a dataset generated from this .map file and debugging indicates that 'srcWKT' is an empty string (""), and not NULL.

gdalinfo works correctly though (as does gdal_translate) and its output is shown below.

This file pair can be downloaded for testing in a zip from:
		https://dl.dropbox.com/u/12436846/Cradle%20Mountain.zip

---------------------
	GDALDatasetH  hDataset = GDALOpen( [path cStringUsingEncoding:NSASCIIStringEncoding], GA_ReadOnly );
	
	if ( hDataset == NULL )
	{
		NSLog(@"Failed to get dataset from file:  %@", [path lastPathComponent]);
		
		return NULL;
	}
	
	// Get Source coordinate system.
	
	char *srcWKT = (char *)GDALGetProjectionRef( hDataset );
	
	if ( srcWKT == NULL || strlen(srcWKT) <= 0 )
	{
		NSLog(@"Failed to get WKT (%s) from file:  %@", srcWKT, [path lastPathComponent]);
		
		return NULL;
	}
--------------------
Failed to get WKT () from file:  Cradle Mountain_ozf.map
--------------------

--------------------
$ ./gdalinfo /Users/nsands/Public/map/Test/Cradle\ Mountain/Cradle\ Mountain_ozf.map
Driver: OZI/OziExplorer Image File
Files: /Users/nsands/Public/map/Test/Cradle Mountain/Cradle Mountain_ozf.map
Size is 6535, 11880
Coordinate System is `'
GCP Projection = 
PROJCS["UTM Zone 55, Southern Hemisphere",
    GEOGCS["GDA94",
        DATUM["Geocentric_Datum_of_Australia_1994",
            SPHEROID["GRS 1980",6378137,298.257222101,
                AUTHORITY["EPSG","7019"]],
            TOWGS84[0,0,0,0,0,0,0],
            AUTHORITY["EPSG","6283"]],
--------------------
etc...

Any help with where I'm going wrong would be much appreciated.

Cheers,
Nik.



More information about the gdal-dev mailing list