private byte[] transform(string wktTo, string wktFrom) { if (importLayer == null) { return(null); } SpatialReference srFrom = null; double[] toWGS84Data = new double[7]; if (wktFrom == null) { srFrom = importLayer.GetSpatialRef(); } else { srFrom = new SpatialReference(wktFrom); } srFrom.GetTOWGS84(toWGS84Data); if (toWGS84Data[0] == 0) { srFrom.SetTOWGS84(24, -123, -94, 0.02, -0.25, -0.13, 1.1); } var geom = importerCurrentFeature.GetGeometryRef(); if (importLayer.GetSpatialRef() == null) { geom.AssignSpatialReference(srFrom); } SpatialReference srTo = new SpatialReference(wktTo); srTo.GetTOWGS84(toWGS84Data); if (toWGS84Data[0] == 0) { srTo.SetTOWGS84(24, -123, -94, 0.02, -0.25, -0.13, 1.1); } byte[] wkb = null; //sr.SetTOWGS84(24, -123, -94, 0.02, -0.25, -0.13, 1.1); if (geom != null) { string srFromWKT, srToWKT; srFrom.ExportToWkt(out srFromWKT); srTo.ExportToWkt(out srToWKT); if (srFromWKT != srToWKT) { geom.TransformTo(srTo); } wkb = new byte[geom.WkbSize()]; geom.ExportToWkb(wkb); } geom.Dispose(); return(wkb); }