Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Does anyone know how to convert existing line geometry to polygons with arcobjects as it works with the geoprocessing tool "feature to polygon"?

share|improve this question
    
A simple google search should give you examples of how to do this. –  artwork21 Apr 28 '13 at 16:49
    
you can go through this: forums.esri.com/Thread.asp?c=93&f=993&t=173802. –  Emi Apr 29 '13 at 9:03
add comment

2 Answers

The IFeatureConstruct interface has several different methods for doing this.

share|improve this answer
add comment

Here is a function I use:

    public static IPolyline6 PolygonToPolyline(IPolygon4 inPolygon) {

        ISegmentCollection outPolyline = new PolylineClass() as ISegmentCollection;

        try {

            outPolyline.AddSegmentCollection(inPolygon as ISegmentCollection);

            // Mirror spatial reference of input
            IPolyline6 outPolyline_ = outPolyline as IPolyline6;
            outPolyline_.SpatialReference = inPolygon.SpatialReference;

        } catch (Exception ex) {

            Program.Log.Error(string.Format("Util::PolygonToPolyline - {0}", ex.Message));
            Program.Log.Error(ex.ToString());

        }

        return outPolyline as IPolyline6;

    }
share|improve this answer
    
It sounds like the opposite is what is being requested. –  blah238 Apr 29 '13 at 4:55
    
Thank you very much for this reply. But I think this is to transform polygon to polyline and I happen to want the opposite solution which is to transform lines to polygon. –  Yvan May 3 '13 at 21:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.