[GRASS-dev] vlib api: is area an isle?

Markus Metz markus.metz.giswork at gmail.com
Mon Mar 25 01:44:55 PDT 2013

On Sat, Mar 23, 2013 at 7:01 PM, Martin Landa <landa.martin at gmail.com> wrote:
> Hi,
> I am trying to find a way how to determine if an area forms an isle
> using vlib API? Eg.
> $ v.buffer in=roadsmajor out=rb dist=1000
> produces
> 17 areas (1 area with category + 16 areas (without categories) forms isles)
> 17 isles (one "universal isle" + 16 "holes" in area)
> Is there any way how to determine from topology that given area forms
> an isle.

The programmer's manual [0] explains to relation between areas, isles
and holes inside areas. An area can be part of an isle, or IOW, an
isle can consist of several areas. Each area is also (part of) an
isle. As Robert Lagacé explained, each boundary is followed clockwise
(to build areas) and CCW (to build isles).

> Such area has no category, but it's a weak precondition. We
> can have areas with no category (no centroid defined for such area)
> which do not form isles ("hole in polygon" from simple feature
> terminology).
> I would like to go through all areas and skip the areas which form isles.
> for (area = 1; area <= nareas; area) {
>      if (Vect_is_area_isle(Map, area)
>         continue;
> }

All areas also form isles. You probably want to skip areas that are
part of isles which in turn are inside another area. The easiest way
to find out if an area is part of an isle inside another area is to go
through the area's boundaries, get for each boundary the areas on the
left and right and check if one of them is an isle. Then use
Vect_get_isle_area() and check if this is > 0.

Markus M

[0] http://grass.osgeo.org/programming7/vlibTopology.html#vlibTopoManagement

More information about the grass-dev mailing list