[GRASS-user] Removing small areas using v.clean

Dear list,

I got a problem as I'm trying to remove small areas of a vector layer
using v.clean with the rmarea tool: some of these small areas that are
on the boundary of the layer are getting erased rather than being
merged with the closest polygon.

Is that an expected behaviour?

Cheers,

Pierre

--
Scientist
Landcare Research, New Zealand

On Fri, Sep 16, 2011 at 6:28 AM, Pierre Roudier
<pierre.roudier@gmail.com> wrote:

Dear list,

I got a problem as I'm trying to remove small areas of a vector layer
using v.clean with the rmarea tool: some of these small areas that are
on the boundary of the layer are getting erased rather than being
merged with the closest polygon.

Is that an expected behaviour?

No, they should always be merged with a neighbouring area along the
shared boundary. Areas are supposed to be erased only if they are
isolated, i.e. do not share a boundary with another area. What GRASS
version are you using? There was a bug which was fixed 2 years ago.

Markus M

Markus,

Sorry for this late reply as I was away from keyboard the last few days,

I encountered this problem while testing the latest grass_svn (grass
7). I can give it a shot using a stable version if you want,

Pierre

2011/9/17 Markus Metz <markus.metz.giswork@googlemail.com>:

On Fri, Sep 16, 2011 at 6:28 AM, Pierre Roudier
<pierre.roudier@gmail.com> wrote:

Dear list,

I got a problem as I'm trying to remove small areas of a vector layer
using v.clean with the rmarea tool: some of these small areas that are
on the boundary of the layer are getting erased rather than being
merged with the closest polygon.

Is that an expected behaviour?

No, they should always be merged with a neighbouring area along the
shared boundary. Areas are supposed to be erased only if they are
isolated, i.e. do not share a boundary with another area. What GRASS
version are you using? There was a bug which was fixed 2 years ago.

Markus M

--
Scientist
Landcare Research, New Zealand

On Wed, Sep 21, 2011 at 12:51 AM, Pierre Roudier
<pierre.roudier@gmail.com> wrote:

Markus,

Sorry for this late reply as I was away from keyboard the last few days,

I encountered this problem while testing the latest grass_svn (grass
7). I can give it a shot using a stable version if you want,

You can try, but I would be surprised if the result is any different.
Can you make the vector available for testing, or can you reproduce
this with a vector of the sample datasets?

Markus M

2011/9/17 Markus Metz <markus.metz.giswork@googlemail.com>:

On Fri, Sep 16, 2011 at 6:28 AM, Pierre Roudier
<pierre.roudier@gmail.com> wrote:

Dear list,

I got a problem as I'm trying to remove small areas of a vector layer
using v.clean with the rmarea tool: some of these small areas that are
on the boundary of the layer are getting erased rather than being
merged with the closest polygon.

Is that an expected behaviour?

No, they should always be merged with a neighbouring area along the
shared boundary. Areas are supposed to be erased only if they are
isolated, i.e. do not share a boundary with another area. What GRASS
version are you using? There was a bug which was fixed 2 years ago.

Markus M

--
Scientist
Landcare Research, New Zealand

Thanks Markus,

Here's an archive containing the input vector layer, along with
v.clean output:
https://df.bestgrid.org/quickshare/fb0bb3af778c8a03/vectors.tar.gz

Here's the result of v.info -h on the output:

COMMAND: r.to.vect input="c_means" output="foo" feature="area"
GISDBASE: /data/GRASSDATA
LOCATION: NZTM2000 MAPSET: BH USER: roudierp DATE: Thu Sep 15 17:29:53 2011
---------------------------------------------------------------------------------
COMMAND: v.clean input="foo" layer="1"
type="point,line,boundary,centroid,area,face,kernel" output="bar"
tool="rmar
ea" thresh=900
GISDBASE: /data/GRASSDATA
LOCATION: NZTM2000 MAPSET: BH USER: roudierp DATE: Thu Sep 15 17:31:45 2011
[Raster MASK present]

Cheers,

Pierre

2011/9/21 Markus Metz <markus.metz.giswork@googlemail.com>:

On Wed, Sep 21, 2011 at 12:51 AM, Pierre Roudier
<pierre.roudier@gmail.com> wrote:

Markus,

Sorry for this late reply as I was away from keyboard the last few days,

I encountered this problem while testing the latest grass_svn (grass
7). I can give it a shot using a stable version if you want,

You can try, but I would be surprised if the result is any different.
Can you make the vector available for testing, or can you reproduce
this with a vector of the sample datasets?

Markus M

2011/9/17 Markus Metz <markus.metz.giswork@googlemail.com>:

On Fri, Sep 16, 2011 at 6:28 AM, Pierre Roudier
<pierre.roudier@gmail.com> wrote:

Dear list,

I got a problem as I'm trying to remove small areas of a vector layer
using v.clean with the rmarea tool: some of these small areas that are
on the boundary of the layer are getting erased rather than being
merged with the closest polygon.

Is that an expected behaviour?

No, they should always be merged with a neighbouring area along the
shared boundary. Areas are supposed to be erased only if they are
isolated, i.e. do not share a boundary with another area. What GRASS
version are you using? There was a bug which was fixed 2 years ago.

Markus M

--
Scientist
Landcare Research, New Zealand

--
Scientist
Landcare Research, New Zealand

BTW I confirm I got similar problems with the 6.4 series,

Pierre

2011/9/22 Pierre Roudier <pierre.roudier@gmail.com>:

Thanks Markus,

Here's an archive containing the input vector layer, along with
v.clean output:
https://df.bestgrid.org/quickshare/fb0bb3af778c8a03/vectors.tar.gz

Here's the result of v.info -h on the output:

COMMAND: r.to.vect input="c_means" output="foo" feature="area"
GISDBASE: /data/GRASSDATA
LOCATION: NZTM2000 MAPSET: BH USER: roudierp DATE: Thu Sep 15 17:29:53 2011
---------------------------------------------------------------------------------
COMMAND: v.clean input="foo" layer="1"
type="point,line,boundary,centroid,area,face,kernel" output="bar"
tool="rmar
ea" thresh=900
GISDBASE: /data/GRASSDATA
LOCATION: NZTM2000 MAPSET: BH USER: roudierp DATE: Thu Sep 15 17:31:45 2011
[Raster MASK present]

Cheers,

Pierre

2011/9/21 Markus Metz <markus.metz.giswork@googlemail.com>:

On Wed, Sep 21, 2011 at 12:51 AM, Pierre Roudier
<pierre.roudier@gmail.com> wrote:

Markus,

Sorry for this late reply as I was away from keyboard the last few days,

I encountered this problem while testing the latest grass_svn (grass
7). I can give it a shot using a stable version if you want,

You can try, but I would be surprised if the result is any different.
Can you make the vector available for testing, or can you reproduce
this with a vector of the sample datasets?

Markus M

2011/9/17 Markus Metz <markus.metz.giswork@googlemail.com>:

On Fri, Sep 16, 2011 at 6:28 AM, Pierre Roudier
<pierre.roudier@gmail.com> wrote:

Dear list,

I got a problem as I'm trying to remove small areas of a vector layer
using v.clean with the rmarea tool: some of these small areas that are
on the boundary of the layer are getting erased rather than being
merged with the closest polygon.

Is that an expected behaviour?

No, they should always be merged with a neighbouring area along the
shared boundary. Areas are supposed to be erased only if they are
isolated, i.e. do not share a boundary with another area. What GRASS
version are you using? There was a bug which was fixed 2 years ago.

Markus M

--
Scientist
Landcare Research, New Zealand

--
Scientist
Landcare Research, New Zealand

--
Scientist
Landcare Research, New Zealand

On Thu, Sep 22, 2011 at 5:26 AM, Pierre Roudier
<pierre.roudier@gmail.com> wrote:

BTW I confirm I got similar problems with the 6.4 series,

Thanks for the input vector, I could reproduce the effect. But I am
not sure if this is really a problem. The method to remove small areas
finds the neighbouring area with which the longest boundary is shared.
This neighbouring area can also be the surrounding "nothing" in which
case the area is not merged with a real area but erased. That is, my
first comment was wrong, areas are not always merged with a
neighbouring real area, only if this neighbouring real area is the one
with the longest shared boundary. The cleaning tool assumes that small
areas are spurious and removes them by merging or by erasing. In case
of ties, when there are two neighbours with equally longest shared
boundary, as in your case, whichever neighbour is checked first will
be used. That neighbour can also be the empty space around.

Markus M

2011/9/22 Pierre Roudier <pierre.roudier@gmail.com>:

Thanks Markus,

Here's an archive containing the input vector layer, along with
v.clean output:
https://df.bestgrid.org/quickshare/fb0bb3af778c8a03/vectors.tar.gz

Here's the result of v.info -h on the output:

COMMAND: r.to.vect input="c_means" output="foo" feature="area"
GISDBASE: /data/GRASSDATA
LOCATION: NZTM2000 MAPSET: BH USER: roudierp DATE: Thu Sep 15 17:29:53 2011
---------------------------------------------------------------------------------
COMMAND: v.clean input="foo" layer="1"
type="point,line,boundary,centroid,area,face,kernel" output="bar"
tool="rmar
ea" thresh=900
GISDBASE: /data/GRASSDATA
LOCATION: NZTM2000 MAPSET: BH USER: roudierp DATE: Thu Sep 15 17:31:45 2011
[Raster MASK present]

Cheers,

Pierre

2011/9/21 Markus Metz <markus.metz.giswork@googlemail.com>:

On Wed, Sep 21, 2011 at 12:51 AM, Pierre Roudier
<pierre.roudier@gmail.com> wrote:

Markus,

Sorry for this late reply as I was away from keyboard the last few days,

I encountered this problem while testing the latest grass_svn (grass
7). I can give it a shot using a stable version if you want,

You can try, but I would be surprised if the result is any different.
Can you make the vector available for testing, or can you reproduce
this with a vector of the sample datasets?

Markus M

2011/9/17 Markus Metz <markus.metz.giswork@googlemail.com>:

On Fri, Sep 16, 2011 at 6:28 AM, Pierre Roudier
<pierre.roudier@gmail.com> wrote:

Dear list,

I got a problem as I'm trying to remove small areas of a vector layer
using v.clean with the rmarea tool: some of these small areas that are
on the boundary of the layer are getting erased rather than being
merged with the closest polygon.

Is that an expected behaviour?

No, they should always be merged with a neighbouring area along the
shared boundary. Areas are supposed to be erased only if they are
isolated, i.e. do not share a boundary with another area. What GRASS
version are you using? There was a bug which was fixed 2 years ago.

Markus M

--
Scientist
Landcare Research, New Zealand

--
Scientist
Landcare Research, New Zealand

--
Scientist
Landcare Research, New Zealand

Markus,

Thanks, that means this is no bug then.

However, in my specific case this behaviour is problematic (I do need
to merge small areas into existing/real areas), so maybe a suggestion
could be to control that behaviour through an option? Anyway, as I'm
not able to code it myself in C, so this is just a wish!

Thanks for the time you spent looking into my problem, this is much
appreciated as usual,

Pierre

2011/9/22 Markus Metz <markus.metz.giswork@googlemail.com>:

On Thu, Sep 22, 2011 at 5:26 AM, Pierre Roudier
<pierre.roudier@gmail.com> wrote:

BTW I confirm I got similar problems with the 6.4 series,

Thanks for the input vector, I could reproduce the effect. But I am
not sure if this is really a problem. The method to remove small areas
finds the neighbouring area with which the longest boundary is shared.
This neighbouring area can also be the surrounding "nothing" in which
case the area is not merged with a real area but erased. That is, my
first comment was wrong, areas are not always merged with a
neighbouring real area, only if this neighbouring real area is the one
with the longest shared boundary. The cleaning tool assumes that small
areas are spurious and removes them by merging or by erasing. In case
of ties, when there are two neighbours with equally longest shared
boundary, as in your case, whichever neighbour is checked first will
be used. That neighbour can also be the empty space around.

Markus M

2011/9/22 Pierre Roudier <pierre.roudier@gmail.com>:

Thanks Markus,

Here's an archive containing the input vector layer, along with
v.clean output:
https://df.bestgrid.org/quickshare/fb0bb3af778c8a03/vectors.tar.gz

Here's the result of v.info -h on the output:

COMMAND: r.to.vect input="c_means" output="foo" feature="area"
GISDBASE: /data/GRASSDATA
LOCATION: NZTM2000 MAPSET: BH USER: roudierp DATE: Thu Sep 15 17:29:53 2011
---------------------------------------------------------------------------------
COMMAND: v.clean input="foo" layer="1"
type="point,line,boundary,centroid,area,face,kernel" output="bar"
tool="rmar
ea" thresh=900
GISDBASE: /data/GRASSDATA
LOCATION: NZTM2000 MAPSET: BH USER: roudierp DATE: Thu Sep 15 17:31:45 2011
[Raster MASK present]

Cheers,

Pierre

2011/9/21 Markus Metz <markus.metz.giswork@googlemail.com>:

On Wed, Sep 21, 2011 at 12:51 AM, Pierre Roudier
<pierre.roudier@gmail.com> wrote:

Markus,

Sorry for this late reply as I was away from keyboard the last few days,

I encountered this problem while testing the latest grass_svn (grass
7). I can give it a shot using a stable version if you want,

You can try, but I would be surprised if the result is any different.
Can you make the vector available for testing, or can you reproduce
this with a vector of the sample datasets?

Markus M

2011/9/17 Markus Metz <markus.metz.giswork@googlemail.com>:

On Fri, Sep 16, 2011 at 6:28 AM, Pierre Roudier
<pierre.roudier@gmail.com> wrote:

Dear list,

I got a problem as I'm trying to remove small areas of a vector layer
using v.clean with the rmarea tool: some of these small areas that are
on the boundary of the layer are getting erased rather than being
merged with the closest polygon.

Is that an expected behaviour?

No, they should always be merged with a neighbouring area along the
shared boundary. Areas are supposed to be erased only if they are
isolated, i.e. do not share a boundary with another area. What GRASS
version are you using? There was a bug which was fixed 2 years ago.

Markus M

--
Scientist
Landcare Research, New Zealand

--
Scientist
Landcare Research, New Zealand

--
Scientist
Landcare Research, New Zealand

--
Scientist
Landcare Research, New Zealand