Sunday, 27 November 2016

arcobjects - Export a join table to ArcMap


I have a shapefile (Point) and a table which I join using the following code.


public ITable JoinLayer_Table(IFeatureLayer pFeatLayer, IStandaloneTable pStTable)
{

IDisplayTable pDispTable;
IFeatureClass pFCLayer;
ITable pTLayer;
pDispTable = (IDisplayTable)pFeatLayer;
pFCLayer = (IFeatureClass)pDispTable.DisplayTable;

pTLayer = (ITable)pFCLayer;

IDisplayTable pDispTable2;
ITable pTTable;
pDispTable2 = (IDisplayTable)pStTable;
pTTable = pDispTable2.DisplayTable;

IRelationshipClass pRelClass;
IMemoryRelationshipClassFactory pMemRelFact = new MemoryRelationshipClassFactory();
pRelClass = pMemRelFact.Open("TabletoLayer", (IObjectClass)pTLayer, "HouseNo", (IObjectClass)pTTable, "UNIT_ID", "forward", "backward", esriRelCardinality.esriRelCardinalityOneToMany);



IRelQueryTableFactory pRelQueryTableFact = new RelQueryTableFactory();
ITable pRelQueryTab = (ITable)pRelQueryTableFact.Open(pRelClass, true, null, null, "", true, true);
return pRelQueryTab;
}

The join results is an ITable.


Now I need to make a shapefile from the Join results and add it to the TOC in ArcMap. How can I do this?


Any code example would be greatly appreciated.



Actually I wanted to join two shapefiles (a point shapefile and a polygon shapefile) and get a point shapefile for the JOIN results, but could not do that. So that's why I have a point shapefile and the corresponding dbf of the polygon shapefile to create the Join.


Any help on this also would be greatly appreciated.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...