AnsweredAssumed Answered

Arcobjects .Net - Create a Parcel in Parcel Fabric

Question asked by vinayan on Oct 2, 2015
Latest reply on Oct 26, 2015 by thodson-esristaff

hello,

 

I want to create a new parcel in a parcel fabric. I have the x, y coordinates for the parcels to be created. I searched around a lot and found really nothing that actually "CREATES" a parcel.

 

Here is what I have tried so far.

 

IPointCollection pts = feat.ShapeCopy as IPointCollection; //an existig polygon from another featureclass used for copying x,y,z..

                ICadastralPoints cadPoints = new CadastralPacketClass();

                for (int i = 0; i < pts.PointCount; i++)

                {

                    IPoint p = pts.get_Point(i);

                    IGSPoint gsPt = new GSPointClass();

                    gsPt.X = p.X;

                    gsPt.Y = p.Y;

                    gsPt.Z = p.Z;

                    gsPt.Type = -1; //just tried when nothing worked..made no difference..

                    cadPoints.AddPoint(gsPt);

                }

 

 

                IEnumCELines ceLines = new EnumCELinesClass();

 

 

                ICadastralLines cadLines = new CadastralPacketClass();

                ISegmentCollection segments = feat.ShapeCopy as ISegmentCollection; //an existig polygon from another featureclass used for getting segments

                for (int i = 0; i < segments.SegmentCount; i++)

                {

                    ISegment seg = segments.get_Segment(i);

 

 

                    IGSLine gsLine = new GSLineClass();

                    double bearingDeg = utils.GetBearing(seg.FromPoint, seg.ToPoint);

                    gsLine.Bearing = (Math.PI * bearingDeg) / 180;

                    gsLine.Distance = seg.Length;

 

 

                    ceLines.Add(gsLine);

                }

 

 

                IEnumGSLines gsLines = ceLines as IEnumGSLines;

 

 

                IParcelLineFunctions parcelLineFunctions = new ParcelFunctionsClass();

                IConstructParcelFunctions constrParcelFunctions = new ParcelFunctionsClass();

                ICadastralPacket m_EditPacket = cadExtension.GetEditPacket();

 

 

                IEnumGSParcels outputParcels = null;

                int peRrorLinePointfrom = -1;

                int peRrorLinePointTo = -1;

 

 

                IGSPlan gsPlan = gsParcel.Plan; //gsParcel is an existing parcel..

 

 

                constrParcelFunctions.ConstructParcelsFromLines(gsPlan, cadPoints, gsLines, m_EditPacket, 1, ref outputParcels, ref peRrorLinePointfrom, ref peRrorLinePointTo);

 

 

                IGSParcel resultParcel = outputParcels.Next(); //resultParcel is null now..was expecting this to have some value..

 

 

 

Hope anyone would guide me into right direction..

Outcomes