Skip to main content
1 of 3
TSJ
  • 3.4k
  • 2
  • 27
  • 45

Proper way to check if a Factory Code is Projected or Geographic

I would like to create a SpatialReference with ArcObjects, but I won't know whether it is Projected or Geographic, I'll only have the SRID. Is it fine practice to use 'ISpatialReferenceFactory.CreateGeographicCoordinateSystem' with a 'try', see if it fails, and if so, use 'CreateProjectedCoordinateSystem', and if that fails, give a message that it won't work? I have a feeling that I shouldn't use Exceptions in this way, but I'm not aware of an alternative.

I am aware of these answers, but they don't quite answer the question:

Determining if spatial reference Geographic or Projected using ArcObjects?

How to programmatically determine whether a spatial reference factory code is valid?

TSJ
  • 3.4k
  • 2
  • 27
  • 45