private static ISpatialReference TryGetSpatialRefForAuxFile(string fname, out double[] GTs) { ISpatialReference spatial = null; GTs = null; string wdFile = WorldFile.GetWorldFilenameByRasterFilename(fname); if (File.Exists(wdFile)) { WorldFile wf = new WorldFile(wdFile); GTs = new double[] { wf.MinX, wf.XResolution, 0, wf.MaxY, 0, wf.YResolution }; } string auxFile = fname + ".aux.xml"; if (File.Exists(auxFile)) { XElement ele = XElement.Load(auxFile); XElement srs = ele.Element("SRS"); if (srs != null) { string wkt = srs.Value; spatial = SpatialReference.FromWkt(wkt, enumWKTSource.EsriPrjFile); } } return(spatial); }