Hi,
How can i get the center point in a feature.
I am using GetBoundingBox().GetCenterPoint().
But sometimes its going outside the feature is there any other way to get it,so that it lies with in that shape.
Thanks.
Center point in a Feature
Hi Lalitya,
In fact our GetCenterPoint get the Centroid point of shape. So please don’t GetBoundingBox before GetCenterPoint.
The BoundingBox is not equal the shape itself.
As below a quickly test sample, you can see p1 = (3.888888888888889, 5) but p2 = (5, 5) in result.
Collection<Vertex> vs = new Collection<Vertex>();
vs.Add(new Vertex(0, 0));
vs.Add(new Vertex(0, 10));
vs.Add(new Vertex(10, 10));
vs.Add(new Vertex(5, 5));
vs.Add(new Vertex(10, 0));
vs.Add(new Vertex(0, 0));
RingShape rs = new RingShape(vs);
PolygonShape ps = new PolygonShape(rs);
PointShape p1 = ps.GetCenterPoint();
PointShape p2 = ps.GetBoundingBox().GetCenterPoint();
Any question please let me know.
Regards,
Don