Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have seen this code in Arcpy which is used to create a Polygon from a string of Points(X , Y).Can you please let me know how I can us something like this which can generate polygon from an array of X,y values in C# and Arcobjects?

I already take alook at Arcobjects 10 .net framework sample code sample of Building a Polygon Using Points . but it was too confusing for me.

I really appreciate your time if you can point me to a tutorial or a sample which contains a process of polygon creation same as what was in arcpy code.

share|improve this question

Here's one way to do it. There's probably a better way.

void IPointCollection makePC(List<IPoint> pList)

IGeometryBridge2 pGeoBrg = new GeometryEnvironment() as IGeometryBridge2;
IPointCollection4 pPointColl = new PolylineClass();
int numPoints = pList.Count; 
WKSPoint[] aWKSPointBuffer = new WKSPoint[numPoints];
for(int i =0; i < pList.Count; i++)
WKSPoint A = new WKSPoint();
A.X = pList[i].X;
A.Y = pList[i].Y;
aWKSPointBuffer[i] = A;
pGeoBrg.SetWKSPoints(pPointColl, ref aWKSPointBuffer);

return pPointColl; 
share|improve this answer
Hi Patrick and thanks for your comment, but my problem is I do not know how to create a shapefile! before adding the points. – user1106951 Aug 2 '12 at 15:17
@user1106951 Then ask a different question – patrick Aug 2 '12 at 15:40

Your Answer


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.