Select to view content in your preferred language

Getting newly created parcels from a parcel job

1931
3
02-09-2011 11:54 AM
DanNarsavage
Frequent Contributor
At the moment a parcel job is finished in Parcel Editor, I'm attempting to automate the creation of a map that shows the parcels involved before the job (generally a split or combination) and another map that shows the parcels after the job.  One of the many problems I'm encountering is that neither the ICadastralJob::JobParcels or the ICadastralJob::EditParcels properties return FIDs for the newly created parcels. They both contain -1, and maybe that's what I'm looking for, but . . .

Neither the ICadastralEditor::CadastralFabric::get_CadastralTable() or the ICadastralEditor::CadastralFabricLayer.CadastralFabricLayer.get_CadastralSubLayer() methods return a feature class that contains the new parcels either.  How do I get ahold of those polygons so I can put them in another map?  I've tried going through the ICadastralPacketManager::EditLayer & ::JobLayer properties as well, but can't QI to anything useful.

Any help would be greatly appreciated.  Thanks in advance.  Below is a smattering of my code smashed together from a couple different functions. You may find syntactical issues below, but when the code builds & works when it's where it's supposed to be in my spaghetti--it just doesn't give me all the parcels I expect it to.

string JobName = m_ceditor.CurrentJob;
ICadastralPacketManager PacketManager = m_ceditor as ICadastralPacketManager;
ICadastralFabric pFab = m_ceditor.CadastralFabric;
ICadastralJob Job = pFab.GetJob(JobName);

IFIDSet ParcelFIDs = Job.JobParcels;
int eachID;
for (int i = 0; i <= ParcelFIDs.Count(); i++)
{
     ParcelFIDs.Next(out eachID);
     AllEditIDs.Add(eachID);
     ParcelDef = ParcelDef + "OBJECTID = '" + eachID.ToString() + "' OR ";
}
char[] chars = (" OR ").ToCharArray();
ParcelDef = ParcelDef.TrimEnd(chars);

IFeatureClass pParcelFC = pFab.get_CadastralTable(esriCadastralFabricTable.esriCFTParcels) as IFeatureClass;
IDatasetName pDName = (pParcelFC as IDataset).FullName as IDatasetName;
0 Kudos
3 Replies
DanNarsavage
Frequent Contributor
Alternatively, at what point (read, what event can I listen for) will the job and the fabric contain the new parcels?
0 Kudos
JohnFell
Frequent Contributor
Dan,

Did you ever find a solution for this? I would be interested in having this functionality as well. Thanks.
0 Kudos
DanNarsavage
Frequent Contributor
Well . . . I sorta got things to work.  The logic that follows is about as rigorous as the process for getting my GISP was, but it's seemed to work so far . . .   Selecting the parent parcels isn't much of a problem, so I do that by constructing a query from the FIDSet returned by ICadastralJob::EditParcels, thusly (note that there are some values of "-1" in this FIDSet that represent the prodigal child parcels (and that don't select anything) but I only anticipate finding the parent parcels anyway):

private string ParcelDefinitionQuery(IFIDSet ParcelFIDs)
{
      try
      {
            string ParDef = "";
            int eachID;
            char[] chars = (" OR ").ToCharArray();
            for (int i = 0; i <= ParcelFIDs.Count(); i++)
            {
                 ParcelFIDs.Next(out eachID);
                 if (eachID > 0)
                      ParDef = ParDef + "OBJECTID = " + eachID.ToString() + " OR ";
            }
            ParDef = ParDef.TrimEnd(chars);
            return ParDef;
     }
     catch (Exception ex)
     {
         throw ex;
     }
}



Note that the above must be done before the job is committed (before the job object loses its reference to all its parcels)--it gets done when the user clicks "Finish Job." The stuff below must be done later (after those new parcels have appeared in the polygon feature class & been given real FIDs)--I listen for the user to stop editing (which actually happens even when the user clicks "Save Edits" as well as "Stop Editing").

Then I create a GeometryBag & fill it with all those parcels, & then use that to perform a spatial filter to find all non-historical parcels whose interiors intersect those of the parents, thusly:


ISpatialFilter pSF = new SpatialFilterClass();
pSF.Geometry = pTotalParent;
pSF.SearchOrder = esriSearchOrder.esriSearchOrderSpatial;
pSF.SpatialRel = esriSpatialRelEnum.esriSpatialRelRelation;
pSF.SpatialRelDescription = "T********";     // Sel parcels whose interiors touch parents' interiors
pSF.WhereClause = "Historical = 0";
pFCursor = tempFC.Search(pSF, false);


And there you have it. I'm still trying to finish debugging this stuff, but I THINK that the code here works. Like I said, it's not very rigorous, and it might not work if your parcel editing workflow is different from ours. My advice to you is to get out of the parcel mapping business. 🙂

Have fun,
Dan
0 Kudos