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

Moritz Lennert mlennert at club.worldonline.be
Fri Apr 10 06:03:18 EDT 2009


On 10/04/09 11:56, Markus Neteler wrote:
> 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?

To me, yes. But I think that (in addition) for grass7, we should go for 
Markus M's suggestion of making -c the default (i.e. inversing the 
meaning of the flag).

Moritz


More information about the grass-user mailing list