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

Markus Neteler neteler at osgeo.org
Fri Apr 10 05:56:34 EDT 2009


On Thu, Apr 9, 2009 at 11:01 AM, Moritz Lennert
<mlennert at club.worldonline.be> wrote:
> On 09/04/09 10:47, Markus Neteler wrote:
>> On Thu, Apr 9, 2009 at 10:38 AM, Hamish <hamish_b at yahoo.com> wrote:
>>>> Hamish wrote:
>>>>>
>>>>> I've got a grass vector map containing some areas with holes.

A nice example is Italy...

GRASS 6.5.svn (LL):~ > v.out.ogr italy_country dsn=italy.shp type=area
Exporting 26 areas (may take some time)...
 100%
31 features written
WARNING: 5 features without category were written

GRASS 6.5.svn (LL):~ > v.out.ogr -c italy_country
dsn=italy_with_islands.shp type=area
Exporting 26 areas (may take some time)...
 100%
21 features written
WARNING: 5 features found without category were skipped

# verification
GRASS 6.5.svn (LL):~ > qgis italy.shp italy_with_islands.shp

Indeed, the -c is the correct way to export the map (too bad that the
default settings fail!).

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?

Markus


More information about the grass-user mailing list