Problem / Question on projections

Discussion created by bpokorny on Sep 29, 2010
Latest reply on Feb 14, 2011 by jdwilliams2
Hi all:

I have spent countless hours trying to understand projections and conversions, etc...

I think I have a fairly simple an common question, although trying to weed through the code examples and documentation, I have been unsuccessful in finding a solution.

A little background:

I have a map that appears to be displaying x/y in Virginia State Plane (ex: 3367638.0705937, 11241037.076929).  It appears to be in feet.??

I have a coordinate of 42.234234, -79.234234 for example, which is WGS-1984?  When I try to perform a map.putcoords(x,y), it puts me in the middle of the ocean somewhere.

I'm not 100% exactly sure what I am looking for, but I know I need to do the following:
Take the example coordinates (show above), convert them to Virginia State Plane?
Move or Pan the map to that location and put a point on the map.

Sounds easy, right?!  Here is some [incomplete] example code that I have done so far. 

            Dim pSpatRefFact As ISpatialReferenceFactory2
            pSpatRefFact = New SpatialReferenceEnvironmentClass

            m_pGeographicCoordinateSystem = pSpatRefFact.CreateGeographicCoordinateSystem(ESRI.ArcGIS.Geometry.esriSRGeoCSType.esriSRGeoCS_WGS1984)

            m_pProjectedCoordinateSystem = pSpatRefFact.CreateProjectedCoordinateSystem(esriSRProjCSType.esriSRProjCS_NAD1983HARNSPCS_VANorth)

        Dim p As IPoint
        p = New Point

        p.PutCoords(-79.23452, 42.231123)
        p.SpatialReference = m_pGeographicCoordinateSystem

Couple issues:
I'm not sure I am using or understand the PCS is the correct one.  That should be what projections my map is currently in - right?
Secondly, when I enter the code: pSpatRefFact = New SpatialReferenceEnvironmentClass, I get an error telling me 'Interop type 'SpatialReferenceEnvironmentClass' cannot be embedded.  Use the applicable interface instead.'

This is code taken directly from an example.  I am using VS2010 .Net 4.0 w/ArcEngine 10.0 if that matters at all.

Coule someone please provide me an accurate, working example of how to convert WGS1984 to Virginia State Plane, pan the map to the appropriate coordinate and place a simple point on the map?  This is becoming very frustrating and time consuming.

Lastly, are there webinars, videos, etc... that can shed some light on these issues?

Thanks for your help.