AnsweredAssumed Answered

How do I get a Spatial Reference from a Feature Dataset Path?

Question asked by rfairhur24 Champion on Apr 13, 2015
Latest reply on Apr 14, 2015 by rfairhur24

I am trying to create a custom geoprocessing custom tool and have set the output parameter to create a new feature class.  If the user chooses an output to a feature dataset path that exists, but contains no actual feature classes or other data, how can I discover the spatial reference of the feature dataset?  I need the output spatial reference to determine whether or not the dataset will contain feature classes with a Projected Coordinate System (PCS) or Geographic Coordinate System (GCS) and generate an error if the dataset output will use a GCS.  I do not want to create a feature class temporarily just to determine the feature dataset's spatial reference.


From the IGPValue of the output I can cast to the IName interface and find out if the output will be stored in a feature dataset by attempting to cast IName to an IFeatureDatasetName, but I am not sure how to get from that interface to the spatial reference of the feature dataset.  Even if I could navigate to the IFeatureDataset interface I don't see a method that would let me extract the spatial reference of the feature dataset.  Any ideas on what set of interfaces gets me from the path string of an existing feature dataset to the spatial reference of that feature dataset?


It seems like the spatial reference should be one of the main properties of a feature dataset, since one of the primary characteristic of a feature dataset is that nothing can be stored within it that does not match the feature dataset's spatial reference.


I prefer to use VB.Net, but any .Net code that shows the interface path I need to use is fine.