Getting the exterior rings of a vector layer

Topics: General Topics
Feb 13, 2007 at 11:28 AM
Hi,

What I basically want to do is set the interior rings property of a polygon to be equal to the exterior rings of another polygon. Any idea as to how I would go about this? I can't seem to get the exterior rings from a vector layer as a LinearRing no matter what I try!

Thanks,

Dylan
Feb 13, 2007 at 12:59 PM
Persevere and you'll figure it out. I should remember that! Anyway, I managed to get something that works -

SharpMap.Data.Providers.GeometryProvider inside = new SharpMap.Data.Providers.GeometryProvider(
    area.DataSource.GetGeometriesInView(map.Envelope));
 
foreach (SharpMap.Geometries.MultiPolygon multi in inside.Geometries)
{
    foreach (SharpMap.Geometries.Polygon poly in multi)
    {
        mask.InteriorRings.Add(poly.ExteriorRing);
    }
}

Where "area" is the vector layer I needed to get the data from, "map" is the map I am working with, and "mask" is the polygon I was adding the interior rings to.