AnsweredAssumed Answered

Project to Lat/Long for Google maps using arcobjects

Question asked by jbinbama on Oct 8, 2014
Latest reply on Oct 8, 2014 by riyasdeen_b

I'm trying to take a coordinate and convert it to Lat/Long for google maps but I don't know enough about projections to handle this.   I know it should be something like this but not sure what my Geo Types should ge or what the SetFalseOriginAndUnits is used for - can someone point me in the right direction?  I'm guessing I don't have the coordinate types correct or I need to project the coordinate somehow.

 

                ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironmentClass();

                //GCS to project from

                int geoType = (int)esriSRGeoCSType.esriSRGeoCS_NAD1983;

 

                var gcs = srFactory.CreateGeographicCoordinateSystem(geoType);

                ISpatialReference sr1 = gcs;

 

                // what should this be???

                //sr1.SetFalseOriginAndUnits(-180, -90, 1000000);

                

                //Projected Coordinate System to project into

                int geoType2 = (int)esriSRProjCSType.esriSRProjCS_NAD1983N_AmericaLambert;

                var pcs = srFactory.CreateProjectedCoordinateSystem(geoType2);

 

                // what should this be???

                //pcs.SetFalseOriginAndUnits(0, 0, 1000);

 

                ISpatialReference sr2 = pcs;

                //Point to project

                var point = new PointClass() as IPoint;

 

                 point.PutCoords(2396130.0831298800, 15867438.6259155000);

                //Geometry Interface to do actual project

                var geometry = point;

                geometry.SpatialReference = sr1;

                geometry.Project(sr2);

                point = geometry;

                double latitude;

                double longitude;

 

                point.QueryCoords(out latitude, out longitude);

 

 

 

My map layer has this info:

                NAD83 UTM, Zone 18 North, US Foot

                Authority: Custom

 

                Projection: Transverse_Mercator

                false_easting: 1640416.614993545

                false_northing: 0.0

                central_meridian: -75.0

                scale_factor: 0.9996

                latitude_of_origin: 0.0

                Linear Unit: Foot_US (0.3048006096012192)

 

                Geographic Coordinate System: North_American_Datum_1983

                Angular Unit: Degree (0.0174532925199433)

                Prime Meridian: Greenwich (0.0)

                Datum: D_North_American_1983

                  Spheroid: Geodetic_Reference_System_of_1980

                    Semimajor Axis: 6378137.0

                    Semiminor Axis: 6356752.31414035

                    Inverse Flattening: 298.2572221009113

Outcomes