Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have created a buffer as follows

IMap map = axMapControl1.ActiveView.FocusMap;
IFeatureSelection fSelection = map.get_Layer(0) as IFeatureSelection;    
ISelectionSet selSet = fSelection.SelectionSet;    
ICursor cursor;
selSet.Search(null, true, out cursor);

IFeature feat = ((IFeatureCursor)cursor).NextFeature();
ITopologicalOperator topoOpr = feat.Shape as ITopologicalOperator;

IPolygon buffPolygon = topoOpr.Buffer(100) as IPolygon;

IActiveView activeView=axMapControl1.ActiveView;
IScreenDisplay screendispaly = activeView.ScreenDisplay;
screendispaly.StartDrawing(screendispaly.hDC, (System.Int32)esriScreenCache.esriAllScreenCaches);    

ISimpleFillSymbol simFillSymbol = new SimpleFillSymbolClass() ;
simFillSymbol.Style = esriSimpleFillStyle.esriSFSSolid;
IRgbColor color = new RgbColorClass();
color.Red = 255;
simFillSymbol.Color = color;

ISymbol symbol = simFillSymbol as ISymbol;
screendispaly.SetSymbol(symbol);    
screendispaly.DrawPolygon(buffPolygon);

Now I can see a buffer around a feature and I want to save it as a feature class into a database.

How can I do it?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted
//get the featureclass from first layer
IFeatureLayer featureLayer = (IFeatureLayer)map.get_Layer(0)
IFeatureClass featureClass = featureLayer.FeatureClass;
//create a new feature(row)
IFeature feature = featureClass.CreateFeature();
feature.Shape = buffPolygon ;
// Save feature to database
feature.Store();

Read Creating Features for detailed descriptions.

share|improve this answer
    
Thanks vinayan. It worked. :) –  Arun Yegi Jan 18 '13 at 3:58
    
glad it helped..please check the green tick mark left to this answer to make it accepted.. –  vinayan Jan 18 '13 at 5:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.