I have a set of points from GPS I want to convert them to polygons..I have two approaches to do this.1- convert points to polygon..I do this with below code:
private IPolygon PolygonFromPoint()
{
try
{
IGeometryBridge2 pGeoBrg = new GeometryEnvironment() as IGeometryBridge2;
IPointCollection4 pPointColl = new PolygonClass();
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);
IPolygon pPointColl2 = pPointColl as IPolygon;
pPointColl2.SpatialReference = spatialrefrence;
OutputPolygon = pPointColl2;
status = true;
return pPointColl2;
}
catch (Exception e)
{
MessageBox.Show("PolygonFromPoint: " + e.Message);
status = false;
return null;
}
}
This works some times but some times I get the error that says the polygon is not colosed.I could not manage to fix this problem
Another way is converting to closed polyline and then convert them to a polygon.I managed to convert them to polyline using geoprosseor but can not convert it to polygons.(I can not use feature to polygon either because of licence problam).
So what ways do you suggest me to do this task?I can not find any samples or something like that.Can you please help me do this?
I am using ArcObjects 10.2.1 and C# thanks a lot