Dim shpL As New List(Of Object) shpL.Add(plyLine) shpL.Add(plyGon) Dim shpLI As Object = Nothing Dim isect As New ESRI.ArcGIS.AnalysisTools.Intersect(shpL, shpLI) shpLI = isect.out_feature_class
Found this link in the docs that talks about exactly what I need to do:
http://edndoc.esri.com/arcobjects/9.2/NET/shared/geoprocessing/analysis_tools/how_intersect_analysis...
But I can't find any code examples, etc on actually doing this?
I have a polygon and a polyline and I want to get the intersects between the two.
Is this functionality even available with .Net and ArcGISEngine 10?
Can someone please point me in the right direction here.
Doug.
Dim gp As New ESRI.ArcGIS.Geoprocessor.Geoprocessor gp.SetEnvironmentValue("workspace", wksp.PathName) Dim s As String = "" Dim vt As ESRI.ArcGIS.Geoprocessing.IGpValueTableObject = New ESRI.ArcGIS.Geoprocessing.GpValueTableObjectClass() vt.SetColumns(2) s = GetPathForALayer(MyPolygonLayer) vt.AddRow("'" & s & "' 1") s = GetPathForALayer(MyPolylineLayer) vt.AddRow("'" & s & "' 2") Dim fcname As String = "my_intersect_" & MyID & "_" & Guid.NewGuid.ToString.Replace("-", "") 'Uses a guid to ensure unique name s = System.IO.Path.Combine(wksp.PathName, fcName) Dim pVarArray As IVariantArray = New VarArrayClass() pVarArray.Add(vt) pVarArray.Add(s) gp.Execute("intersect_analysis", pVarArray, Nothing) Dim fWk As IFeatureWorkspace = wksp Dim fcTmp = fWk.OpenFeatureClass(fcname)
I don't know anything about Analysis services, but I am calculating intersections, overlapping areas, etc, with ITopologicalOperator4, IRelationalOperator, IProximityOperator, and IGeometry5. For an intersection for example, I simply take an IFeature.Shape and intersect it with another IFeature.Shape...
Friend Function GetIntersectedPolygon(ByVal OtherPolygon As IGeometry5) As IGeometry5
Dim intersectedGeometry As IGeometry5 = Nothing
intersectedGeometry = ITopologicalOperator4.Intersect(OtherPolygon, esriGeometryDimension.esriGeometry2Dimension)
Return intersectedGeometry
End Function
IGPUtilities2 gpUtils = new GPUtilitiesClass(); IFeatureClass inFeature1 = gpUtils.OpenFeatureClassFromString(@" ");//path of the 1st Input Feature Class IFeatureClass inFeature2 = gpUtils.OpenFeatureClassFromString(@" ");//path of the 2nd Input Feature Class IFeatureClass inFeature3 = gpUtils.OpenFeatureClassFromString(@" ");//path of the 3rd Input Feature Class Test(inFeature1, inFeature2, inFeature3); private void Test(IFeatureClass pf1,IFeatureClass pf2,IFeatureClass pf3) { try { ESRI.ArcGIS.Geoprocessor.Geoprocessor GP = new ESRI.ArcGIS.Geoprocessor.Geoprocessor(); GP.OverwriteOutput = true; IGPUtilities2 gpUtils = new GPUtilitiesClass(); IGpValueTableObject vt = new GpValueTableObjectClass(); vt.SetColumns(2); object weight; weight = 1 as object; object obj1 = pf1; vt.AddRow(ref obj1); vt.SetValue(0, 1, ref weight); object obj2 = pf2; vt.AddRow(ref obj2); vt.SetValue(1, 1, ref weight); object obj3 = pf3; vt.AddRow(ref obj3); vt.SetValue(2, 1, ref weight); ESRI.ArcGIS.AnalysisTools.Intersect intersect = new ESRI.ArcGIS.AnalysisTools.Intersect(); intersect.in_features = vt; intersect.out_feature_class = @"D:\Neil'sData\Output\New1.shp";//Specify The Output path GP.Execute(intersect, null); MessageBox.Show("Intersection is Successfull!!!!!!"); } catch (Exception e1) { MessageBox.Show("error!!!!"); } }