Hello everyone,
I want to create a query filter that retrieves the shape field and the folio number of the Parcel layer. Do I need to specify the shape also on the Subfields or only the Folio number?
This is the code I am currently typing:
queryFilterParcel = New QueryFilterClass()
' Select the fields to be returned
queryFilterParcel.SubFields = "FOLIO"
I am not seeing how you are using the filter .... When I need geometry I either use a SpatialFilterClass or simply attach the queryfilter using a cursor.....
Example:
IFeatureLayer ilayer = (IFeatureLayer)ArcMap.Document.FocusMap.get_Layer(0);
IQueryFilter queryFilterlast = new QueryFilterClass();
IFeatureClass pFc = ilayer.FeatureClass;
IFeatureCursor pFCursor;
IFeature pF;
queryFilterlast.WhereClause = null;
pFCursor = pFc.Search(queryFilterlast, false);
pF = pFCursor.NextFeature();
while (pF != null && pF.Shape != null && pF.Shape.IsEmpty == false ) {
if (pFc.ShapeType == esriGeometryType.esriGeometryLine || pFc.ShapeType == esriGeometryType.esriGeometryPolyline) {
ICurve curveForLength = (ICurve)pF.Shape;
System.Diagnostics.Debug.WriteLine(curveForLength.Length.ToString());
}
pF = pFCursor.NextFeature();
}
I am looking copy all the Parcels that belong to the same Project in the Project layer. For this my idea is to find all the polygons in the Parcel layer. select all the polygons, union them and copy them in the Project layer.
In my case I need to query all the Parcel features that match the folios in the WhereClause and then select the polygons, Union them and create a new feature in the Projects layer.
queryFilterPaParcel.WhereClause = "FOLIO = '123456789' or FOLIO = '321654987'"
I think that I need a
Dim pSelectionSet As ISelectionSet
I do not believe it is wise to combine two different data sets, you will only gain more headaches in future use. I would highly advise that you first approach your problem manually in order to gain insight in the steps needed to obtain your desired results. Reading your problem, I am assuming that you currently have two layers: 1. Layer containing the Projects 2. Layer containing the Parcels. What you are looking to do is to extract or identify those parcels that are within a certain projects.
Manual Steps
1. Create a selection set of the projects you are interested in using Selection-> Select by Attributes You can filter the projects in the selection query. (Source Selection Area)
2. Now I am ready to identify those Parcels that Intersect (Or other spatial operation you desire) those identified Projects. Selection-> Select by Location .. Target layer will be your parcels... Source layer will be the your projects. Click on the Use Selected features checkbox
3. On your parcel layer (Parcels that intersect your project should be highlighted) Here you have the options to do other things now
....
By doing the manual stuff you now have an outline of what you need to perform the operation you want to code for....
In my case above I would have a source and target feature class, on the source create a selection set by projects, using a spatial filter class perform an intersect query... from there you can write or do whatever you want with the resultant data.....
Hope this helps.