Newbie in ArcObjects programming. Using C#. Developing a desktop application.
I need to join 2 tables:
- POI layer which is a Point layer and
- a parcel layer which is a Polygon
Where
POI.HouseNo = Parcel.UNIT_ID
and then create a new Shapefile which has only the 4 fields:
- POIName,
- POIType,
- HouseNo (all from POI layer attributes),
- ParcelName (all from Parcel Layer attributes).
The user selects the POI Layer and the Parcel layer from combo boxes.
Here is the code I have written so far:
IFeatureWorkspace featureWorkspace;
IQueryDef queryDef = featureWorkspace.CreateQueryDef();
queryDef.Tables = cboPOI.Text + "," + cboParcel.Text;
queryDef.SubFields = cboPOI.Text + ".Name," + cboPOI.Text + ".Type," + cboPOI.Text +".HouseNo," + cboParcel.Text + ".ParcelName";
queryDef.WhereClause = cboPOI.Text + ".HouseNo =" + cboParcel.Text+ ".UNIT_ID";
Hope I'm on the right track.
Now I need to run this query and get the output to a new Shapefile. How can I do this?
please help.
Best Answer
The AO-API has got an example. This would mean that you would have to extent your code by the following lines:
And just assign that feture class to a feature layer. Assuming you really want to create a new shapefile in the filesystem, you can export the created feature class with a geoprocessor like FeatureClassToShapefile.