public ISpatialReference getSpatialRef(string catalogpath) { object dtype = ""; ISpatialReference spRef = null; IDataElement dtE = gp.GetDataElement(catalogpath, ref dtype); string datatype = dtE.Type.ToLower(); Console.WriteLine(datatype); try { if (datatype.IndexOf("raster") > -1) { IGeoDataset rstd = (IGeoDataset)getRasterDataset(catalogpath); spRef = rstd.SpatialReference; } else { IGeoDataset ftrs = (IGeoDataset)getFeatureClass(catalogpath); spRef = ftrs.SpatialReference; } } catch (Exception e) { Console.WriteLine("Error: " + e.ToString()); } return(spRef); }
public void refreshCatalog(string path) { IGPUtilities2 gpUtl = new GPUtilitiesClass() as IGPUtilities2; IGeoProcessor gp = getGP(); IGPDataType nm = new GPDateTypeClass(); object dt = ""; IDataElement dtE = gp.GetDataElement(path, ref dt); gpUtl.RefreshCatalog(dtE); }