[gdal-dev] No Spatial Reference System from UTM Ozi .map file

Nik Sands nixanz at nixanz.com
Sun Nov 11 20:02:59 PST 2012


Hi,

I have two sets of Ozi .map files (and corresponding ozf2 files) that behave very differently when processed by GDAL using the following code:

------------------------
	char *srcWKT = (char *)GDALGetProjectionRef( hSrcDS );
	
	if ( srcWKT == NULL || strlen(srcWKT) <= 0 )
		return NO;
	
	printf("srcWKT:\n\n%s\n\n", srcWKT);

	OGRSpatialReferenceH srcSRS = OSRNewSpatialReference(srcWKT);
	
	if ( ! srcSRS )
	{
		printf("FAILED TO GET SOURCE SPATIAL REFERENCE SYSTEM.\n");
	}
------------------------

The first set of .map files work fine, producing output such as this:

------------------------
srcWKT:

PROJCS["unnamed",GEOGCS["AGD66",DATUM["Australian_Geodetic_Datum_1966",SPHEROID["Australian National Spheroid",6378160,298.25,AUTHORITY["EPSG","7003"]],TOWGS84[-117.808,-51.536,137.784,0.303,0.446,0.234,-0.29],AUTHORITY["EPSG","6202"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4202"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",147],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",10000000],UNIT["Meter",1]]
------------------------

However, for the second set I cannot get a spatial reference system and I get this output:

------------------------
srcWKT:

LOCAL_CS[""Ozi" projection "(UTM) Universal Transverse Mercator"",UNIT["Meter",1]]

FAILED TO GET SOURCE SPATIAL REFERENCE SYSTEM.
------------------------

Please help me figure out why the two sets of .map files behave so differently.  In particular, how can I get a spatial reference system for the failing .map files?

(Content of two example files are below.  First one is OK, second one fails.  Let me know if I can provide any further information.)

Thanks in anticipation,
Nik.


OK:
------------------------
OziExplorer Map Data File Version 2.2
R2257
D:\GPS and Mapping\OziExplorer\Maps\Tassie 25k\R2257.ozf2
1 ,Map Code,
Australian Geodetic 1966,,   0.0000,   0.0000,WGS 84
Reserved 1
Reserved 2
Magnetic Variation,,,E
Map Projection,Transverse Mercator,PolyCal,No,AutoCalOnly,No,BSBUseWPX,No
Point01,xy,    0,    0,in, deg,    ,        ,,    ,        ,, grid,   ,220000.77942328,5579999.7247315,
Point02,xy,    1,    0,in, deg,    ,        ,,    ,        ,, grid,   ,220004.03889463,5579999.7247315,
Point03,xy,    0,    1,in, deg,    ,        ,,    ,        ,, grid,   ,220000.77942328,5579996.4652601,
Point04,xy,    1,    1,in, deg,    ,        ,,    ,        ,, grid,   ,220004.03889463,5579996.4652601,
Point05,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point06,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point07,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point08,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point09,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point10,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point11,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point12,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point13,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point14,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point15,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point16,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point17,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point18,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point19,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point20,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point21,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point22,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point23,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point24,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point25,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point26,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point27,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point28,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point29,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point30,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Projection Setup,     0.000000000,   147.000000000,     0.999600000,       500000.00,     10000000.00,,,,,
Map Feature = MF ; Map Comment = MC     These follow if they exist
Track File = TF      These follow if they exist
Moving Map Parameters = MM?    These follow if they exist
MM0,Yes
MMPNUM,4
MMPXY,1,0,0
MMPXY,2,6137,0
MMPXY,3,6137,3069
MMPXY,4,0,3069
MMPLL,1, 143.725652, -39.883721
MMPLL,2, 143.959253, -39.890076
MMPLL,3, 143.955249, -39.980236
MMPLL,4, 143.721343, -39.973861
MM1B,3.251186
MOP,Map Open Position,0,0
IWH,Map Image Width/Height,6137,3069
------------------------



FAILS:
------------------------
OziExplorer Map Data File Version 2.2
r2256.jgw
D:\Documents and Settings\nelsonp\My Documents\General Admin\Personal\Tasmania 1 to 25,000\North West OZF2\r2256.ozf2
1 ,Map Code,
Australian Geodetic 1966,WGS 84,   0.0000,   0.0000,WGS 84
Reserved 1
Reserved 2
Magnetic Variation,,,E
Map Projection,(UTM) Universal Transverse Mercator,PolyCal,No,AutoCalOnly,No,BSBUseWPX,No
Point01,xy,    0,    0,in, deg,    ,        ,,    ,        ,, grid, 55,219999.09067205,5570000.7412442,S
Point02,xy, 1000, 1000,in, deg,    ,        ,,    ,        ,, grid, 55,223259.16350298,5566740.6684133,S
Point03,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point04,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point05,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point06,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point07,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point08,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point09,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point10,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point11,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point12,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point13,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point14,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point15,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point16,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point17,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point18,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point19,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point20,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point21,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point22,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point23,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point24,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point25,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point26,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point27,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point28,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point29,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Point30,xy,     ,     ,in, deg,    ,        ,,    ,        ,, grid,   ,           ,           ,
Projection Setup,     0.000000000,  -120.000000000,     0.999600000,            0.00,     -4000000.00,    34.000000000,    40.500000000,,,
Map Feature = MF ; Map Comment = MC     These follow if they exist
Track File = TF      These follow if they exist
Moving Map Parameters = MM?    These follow if they exist
MM0,Yes
MMPNUM,4
MMPXY,1,0,0
MMPXY,2,6136,0
MMPXY,3,6136,3069
MMPXY,4,0,3069
MMPLL,1, 143.721340, -39.973660
MMPLL,2, 143.955261, -39.980047
MMPLL,3, 143.951253, -40.070068
MMPLL,4, 143.717025, -40.063661
MM1B,3.251882
MOP,Map Open Position,0,0
IWH,Map Image Width/Height,6136,3069
------------------------



More information about the gdal-dev mailing list