gkar68

Intersect two polylines to produce third polyline on 10.1 is broken

Discussion created by gkar68 on Mar 1, 2013
Latest reply on Mar 1, 2013 by whe-esristaff
So, I am migrating code from 9.3 to 10.1 SP1.
The code is working on 9.3, but not on 10.1 SP1

After long fight I narrow the problem to this.

In 10.1 I cannot do intersection between two polylines to produce third polyline.
Is that correct?

I wrote below very simple Visual Studio console application that is doing intersection between two polylines.

I created very two simple polylines, using WKT library , which you can get it from here.
Anyway you can replace it with any code that generate simple polylines.

        static void Main(string[] args)
        {
            //ESRI License Initializer generated code.
            m_AOLicenseInitializer.InitializeApplication(new esriLicenseProductCode[] { esriLicenseProductCode.esriLicenseProductCodeStandard, esriLicenseProductCode.esriLicenseProductCodeAdvanced },
            new esriLicenseExtensionCode[] { });

            var geom1 = "LINESTRING (2 1, 7 1)".ToGeometry();
            var geom2 = "LINESTRING (3 1, 6 1)".ToGeometry();
            var targetOperator = (ITopologicalOperator)geom1;
            targetOperator.Simplify();

            IGeometry intersectGeometry = targetOperator.Intersect(geom2, esriGeometryDimension.esriGeometryNoDimension );
            Console.WriteLine(intersectGeometry.ToWellKnownText());


            m_AOLicenseInitializer.ShutdownApplication();

        }


The above code generate this COM Exception
Error HRESULT E_FAIL has been returned from a call to a COM component.
With error code
-2147467259

Outcomes