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

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. 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;
}

Thanks for any pointers (I just cannot find it), Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

I do not know inside GRASS. But from analytical geometry, if you number not clock wise or conter clock wise,
in case, the Area is positive and in the other it is negative (but I do not remember wich one). You need to look
how it is implemented in GRASS. So, a hole, if correctly marked should a negative area.

Robert Lagacé

________________________________________
De : grass-dev-bounces@lists.osgeo.org [grass-dev-bounces@lists.osgeo.org] de la part de Martin Landa [landa.martin@gmail.com]
Date d'envoi : 23 mars 2013 14:01
À : GRASS developers list
Objet : [GRASS-dev] vlib api: is area an isle?

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. 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;
}

Thanks for any pointers (I just cannot find it), Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

I made typo errors, so drop th previous message.

I do not know inside GRASS. But from analytical geometry, if you number nodes clock wise or conter clock wise, the Area is positive in one case and it is negative in the other (but I do not remember wich one). You need to look how it is implemented in GRASS. So, a hole, if correctly marked should give a negative area.

Robert Lagacé

________________________________________
De : grass-dev-bounces@lists.osgeo.org [grass-dev-bounces@lists.osgeo.org] de la part de Martin Landa [landa.martin@gmail.com]
Date d'envoi : 23 mars 2013 14:01
À : GRASS developers list
Objet : [GRASS-dev] vlib api: is area an isle?

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. 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;
}

Thanks for any pointers (I just cannot find it), Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

On Sat, Mar 23, 2013 at 7:01 PM, Martin Landa <landa.martin@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

Hi,

2013/3/25 Markus Metz <markus.metz.giswork@gmail.com>:

[...]

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

I was not precise enough in my question. But you are right. That's
what I want (concretely for simple feature output defined by
`v.external.out`).

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.

Thanks, I just wondered if there is more straightforward approach.

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

On Tue, Mar 26, 2013 at 1:00 PM, Martin Landa <landa.martin@gmail.com> wrote:

Hi,

2013/3/25 Markus Metz <markus.metz.giswork@gmail.com>:

[...]

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

I was not precise enough in my question. But you are right. That's
what I want (concretely for simple feature output defined by
`v.external.out`).

For simple feature output this is a bit more complicated. The easy
part is to check inner rings of polygons. The more difficult part is
to check if a polygon is inside another polygon. Here you would need
to select all polygons that overlap with the current polygon, then
check if the current polygon is inside any of the overlapping polygons
(the outer ring of the current polygon must be inside the outer ring
of the test polygon and outside any inner rings of the test polygon).

Markus M

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.

Thanks, I just wondered if there is more straightforward approach.

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa