[GRASS-user] exporting areas to shapefiles without filling holes

Markus wrote:

So.... please consider following patch:

svn diff vector/v.out.ogr
Index: vector/v.out.ogr/main.c

--- vector/v.out.ogr/main.c
(revision 36267)
+++ vector/v.out.ogr/main.c
(working copy)
@@ -214,6 +214,9 @@
Vect_set_open_level(2);
Vect_open_old(&In,
in_opt->answer, mapset);

+ if (Vect_get_num_islands(&In) > 0
&& !cat_flag->answer)
+ G_warning(_("The map
contains islands. To preserve them in the
output map, use the -c flag"));
+
/* fetch PROJ info */

G_get_default_window(&cellhd);
if (cellhd.proj == PROJECTION_XY)

v.out.ogr italy_country dsn=italy.shp type=area
WARNING: The map contains islands. To preserve them, use
the -c flag
Exporting 26 areas (may take some time)...
100%
31 features written
WARNING: 5 features without category were written

Makes sense?

perhaps use G_message() so that the user can turn if off if
the message is annoying in a loop? the default does the
unexpected, so some form of message is useful there.

and I support to reverse the flag in grass7 (and no message)
iff this doesn't have side effects for other OGR formats that
we haven't considered while only thinking about shapefiles.

Hamish

On Fri, Apr 10, 2009 at 1:44 PM, Hamish <hamish_b@yahoo.com> wrote:

Markus wrote:

So.... please consider following patch:

svn diff vector/v.out.ogr

...

perhaps use G_message() so that the user can turn if off if
the message is annoying in a loop? the default does the
unexpected, so some form of message is useful there.

For now I have submitted it as G_warning. If loop, there is also
other stuff to suppress maybe.
I tried with G_message but didn't find it visible.

and I support to reverse the flag in grass7 (and no message)

+1

iff this doesn't have side effects for other OGR formats that
we haven't considered while only thinking about shapefiles.

I have for now applied the patch to 7 as well and will leave the
flag inversion (or whatever) to others.

Markus

The behaviour of the -c flag is now reversed in trunk r36726: by default, only features will be exported that have a category in the specified layer.

Markus Neteler wrote:

On Fri, Apr 10, 2009 at 1:44 PM, Hamish <hamish_b@yahoo.com> wrote:
  

perhaps use G_message() so that the user can turn if off if
the message is annoying in a loop? the default does the
unexpected, so some form of message is useful there.
    
For now I have submitted it as G_warning. If loop, there is also
other stuff to suppress maybe.
  

The warning will now appear only if type=area and if the -c flag is set.

Additionally, I made "X features found without category were skipped" a message (was a warning), because this is now the default and expected behaviour.

I have for now applied the patch to 7 as well and will leave the
flag inversion (or whatever) to others.
  

Done.

AFAIKT this filling-holes-issue is not restricted to shapefile export but probably applies to all vector formats that support attributes and/or holes in polygons, e.g. *.kml; didn't check for other formats.

Markus M