I do not want to use ArcMap or any other ESRI tool except ArcObjects to accomplish this task. Another open source solution would also be fine.
I need to convert geometry data from ArcGIS using SQL server to WGS84. I have some code to do a specific projection but I don't know how to apply this to an unknown projection without manually changing the code. As I said the data I need to convert is in an ESRI SQL server. I've looked through the SDE tables and see basically how ESRI stores the data. My question is what table holds the EPSG for the stored projection for a given feature class table so that I can properly provide the esriSRGeoCSType? What esriSRProjCSType do I use for standard lat lon (WGS84) North America?
My goal is to write a simple routine that you can point to a ESRI SQL server, the user selects the feature class table they want to convert and the routine spits out the data along with the geometry projected to WGS84. The original projection is unknown and will have to be retrieved from the ESRI SQL server. Once the user selects the table, the selection is stored the process will continue to run as a service and the process will happen on a timed interval so it needs to be done without further user interaction. Maybe I'm going about it all wrong, I'm a little lost at this point.
UPDATE - RESOLVED Here is the working code to reproject one coordinate system to another. In this case I'm using NJ state plane to WGS84 Lat and Long.
int inEPSG = 3424; int outEPSG = 4326; ISpatialReferenceFactory2 srFactory = new SpatialReferenceEnvironmentClass(); ISpatialReference ProjectedSR = srFactory.CreateSpatialReference(outEPSG); ISpatialReference GeographicSR = srFactory.CreateSpatialReference(inEPSG); double xCoord = 547326.03872482851; double yCoord = 541395.50404749066; IPoint geographicPoint = new PointClass(); geographicPoint.PutCoords(xCoord, yCoord); geographicPoint.SpatialReference = GeographicSR; geographicPoint.Project(ProjectedSR); var _gcsLat = geographicPoint.Y; var _gcsLong = geographicPoint.X;
To get the current EPSG for a particular geometry column in an ESRI geo-enabled database you can retrieve it from the table SDE_geometry_columns. It has a FK relationship to SDE_spatial_references using the srid column. The column auth_srid in SDE_spatial_references will have the EPSG used for that column's coordinate system.
As I thought it was very simple.