public static ESRI.ArcGIS.Geometry.ISpatialReference get_spatialReference(OSGeo.OSR.SpatialReference ogrSR) { ogrSR.MorphToESRI(); string wkt; ogrSR.ExportToWkt(out wkt); ISpatialReferenceFactory4 spatialReferenceFactory = new ESRI.ArcGIS.Geometry.SpatialReferenceEnvironmentClass(); ISpatialReference sr; int bytesRead; spatialReferenceFactory.CreateESRISpatialReference(wkt, out sr, out bytesRead); return sr; }
public static ISpatialReference GetSpatialReference(OSGeo.OSR.SpatialReference ogrSr) { ogrSr.MorphToESRI(); string wkt; ogrSr.ExportToWkt(out wkt); var type = Type.GetTypeFromCLSID(typeof (SpatialReferenceEnvironmentClass).GUID); ISpatialReferenceFactory4 spatialReferenceFactory = (ISpatialReferenceFactory4) Activator.CreateInstance(type); ISpatialReference sr; int bytesRead; spatialReferenceFactory.CreateESRISpatialReference(wkt, out sr, out bytesRead); return sr; }