Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

Intersect two polylines to produce third polyline on 10.1 is broken

$
0
0
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.

Code:

        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

Viewing all articles
Browse latest Browse all 1374

Trending Articles