2

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

2

The IFeatureConstruct interface has several different methods for doing this.

0

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;

    }
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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