I am creating an ArcMap 10.2 extension is VS 2012 and C#. I want to give the user the option to select a spatial reference to be applied to a layer - planning to use the Dialog for that.
But then, I want to be able to save the name of the SR the user selected to an custom XML settings file so that when they come back to the same section it will be set by default (and they can use the Dialog to change it if needed). This is where I am stuck.
My plan was to use that string name and recreate the SR object by see no option for it in something like
As an example, if I run this code on an mxd using a New Jersey projected coordinate system:
ISpatialReference SR = new UnknownCoordinateSystemClass(); IMxDocument Mxd = (IMxDocument)WestonGISExtension.ExtensionApplicationHook.Document; ESRI.ArcGIS.Carto.IMap Map = Mxd.FocusMap; if (Map.SpatialReference != null) SR = Map.SpatialReference;
then, the SR.Name would produce, say, "NAD_1983_StatePlane_New_Jersey_FIPS_2900_Feet". So, how do I later come back with that string and reproduce the
Thanks guys. Ya, I think you are right in going with the WKID. Here is what I settled on:
ISpatialReferenceFactory3 SpatialReferenceFactory = new SpatialReferenceEnvironmentClass(); ISpatialReference SpatialReference = SpatialReferenceFactory.CreateSpatialReference(SpatialReferenceCode);