Sunday, 4 February 2018

coordinate system - Determining if spatial reference Geographic or Projected using ArcObjects?


I have the user select a coordinate system with the Spatial Reference Dialog.


Is there a simple way to determine if the resulting spatial reference is a Projected or Geographic CS?


I would have thought that this would be an attribute of the spatialReference, but it does not seem to be.



Answer



You can check the object type like so:


ISpatialReference ref = ...; // This is your spatial reference
if (ref is IGeographicCoordinateSystem) {

//Geographic
} else if (ref is IProjectedCoordinateSystem) {
// Projected
} else {
// Unknown coordinate system
}

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...