Select to view content in your preferred language

polygon Split

2464
5
06-01-2010 02:09 AM
BrianBorg
Emerging Contributor
I want to develop a webservice using arcobjects that can split a polygon. Any help?

Thanks
0 Kudos
5 Replies
BrianBorg
Emerging Contributor
any help please?
0 Kudos
RuchiraWelikala
Regular Contributor
I'm actually working on this same tool.  I've developed something like this before.  You essentially have to get the envelope of the polygon and apply the split using the topo operator to a copy of the polygon.  How do you plan to split the polygon?  Equal parts?  based on proportions? what shape is the polygon?  You must determine all of these factors (and more) before attempting this procedure.
0 Kudos
BrianBorg
Emerging Contributor
It is quite simple, I have a polygon and a polyline passing through it and I want to split the polygon with this polyline
0 Kudos
RuchiraWelikala
Regular Contributor
It is quite simple, I have a polygon and a polyline passing through it and I want to split the polygon with this polyline


Check this out:
http://edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriGeometry/ITopologicalOperator_Cut.htm
0 Kudos
JohnHauck
Frequent Contributor
Here is a simple example. Also I wanted to point out that the Geometry service at 10.0 has a Cut method that can be used in conjunction with a feature service to modify existing SDE features.

http://help.arcgis.com/EN/arcgisserver/10.0/apis/soap/SOAP_Geometry_Cut.htm


Public Sub splitPolygonWithLine(polyFeature As IFeature, lineFeature As IFeature, outFc As IFeatureClass)
    Dim fields As IFields
    Dim field As IField
    Dim fieldCount As Integer
    Dim topoOp As ITopologicalOperator4
    Dim geoColl As IGeometryCollection
    Dim x As Integer
    Dim outFeat As IFeature
    
    Set topoOp = polyFeature.ShapeCopy
    Set geoColl = New GeometryBag
    Set geoColl = topoOp.Cut2(lineFeature.ShapeCopy)
    Set topoOp = Nothing
    
    x = 0
    
    Do While x < geoColl.GeometryCount
        Set outFeat = outFc.CreateFeature
        Set outFeat.Shape = geoColl.Geometry(x)
        Set fields = polyFeature.fields
        For fieldCount = 0 To fields.fieldCount - 1
            Set field = polyFeature.fields.field(fieldCount)
            If Not field.Type = esriFieldTypeGeometry And Not field.Type = esriFieldTypeOID And field.Editable Then
                outFeat.value(fieldCount) = polyFeature.value(fieldCount)
            End If
        Next fieldCount
        outFeat.Store
        
        x = x + 1
    Loop
    polyFeature.Delete
End Sub

0 Kudos