This project is read-only.

Cast IFeature to polygon

Nov 22, 2014 at 7:12 PM
Hi,I am using SelectByAttribute function which gives me a list of IFeature,I know my Features are polygon.So How can I cast an item in the list to a polygon type?
Is it possible?

Thank you very much
Nov 23, 2014 at 9:55 AM
var polygon = (DotSpatial.Topology.IPolygon) DotSpatial.Topology.Geometry.FromBasicGeometry((DotSpatial.Topology.IBasicGeometry)feature);
// or
polygon = (DotSpatial.Topology.IPolygon) DotSpatial.Topology.Geometry.FromBasicGeometry(feature.BasicGeometry);
Nov 23, 2014 at 12:15 PM
Dear FObermair,
Thank you so much for your help