# How to get the projected coordinate system of an IGeometry?

Question asked by huangs3 on May 23, 2012
Latest reply on Mar 10, 2014 by jitendra_3110
Hi Everybody:

I made a function to convert X/Y coordinate to Lat/Long coordinates. The interface of the function is
=====================================================================================
public static void GetLatLongFromPlannerXY(esriSRProjCSType proj, double x, double y, out double longitude, out double latitude)
=====================================================================================
which takes a predefined projected coordinate system (esriSRProjCSType) as an input.

Now I want to use ArcObject code to retrieve the projected coordinate system of the point geometry (contains X/Y) to be converted instead of hard-coding it.
1. How can I do that?
2. On another hand, the function I wrote can only take predefined projected coordinate systems. Is there any way to improve it to take any projected coordinated systems?

Below is the function code I wrote, any suggestion will be welcome. Thank you!
*********************************************************
public static void GetLatLongFromPlannerXY(esriSRProjCSType proj, double x, double y, out double longitude, out double latitude)
{
ISpatialReferenceFactory factory = null;
IProjectedCoordinateSystem projectedGCS = null;
try
{
factory = new SpatialReferenceEnvironmentClass();
projectedGCS = factory.CreateProjectedCoordinateSystem((int) proj);
WKSPoint pointToConvert = new WKSPoint {X = x, Y = y};
projectedGCS.Inverse(1, ref pointToConvert);
longitude = pointToConvert.X;
latitude = pointToConvert.Y;
}
catch (Exception ex)
{
throw ex;
}
finally
{
Utils.ReleaseComObjects(factory, projectedGCS);
}
}
**************************************************