[GRASS-dev] New v.digit

Glynn Clements glynn at gclements.plus.com
Sat Feb 24 16:59:37 EST 2007


Michael Barton wrote:

> > A question: 
> > What's the idea of the "-n" flag? I could not find out the last
> > years :-) Can we disable it (in the common "deprecated" way)?
> 
> AFAICT, we still need the -n for situations where v.digit is run with the
> name of a map that does not yet exist. Using the -n flag will create a new
> vector map with the specified name and let you start digitizing this map.

The code in question is:

    /* Open map */
    mapset = G_find_vector2 (map_opt->answer, G_mapset()); 
    if ( mapset == NULL ) {
       if ( new_f->answer ) {
	   G_message(_("New empty map created."));
	   Vect_open_new (&Map, map_opt->answer, 0 );
	   Vect_build ( &Map, NULL );
	   Vect_close (&Map);
	   Vect_open_update (&Map, map_opt->answer, G_mapset());
       } else {
	   G_message(_("Map does not exist. Add flag -n to create a new map."));
	   exit(EXIT_FAILURE);
       }
    } else {
	Vect_set_open_level(2);
	Vect_open_update (&Map, map_opt->answer, mapset);
    }

The -n flag is only checked if the map doesn't already exist. In that
case, it could just skip the -n check and create the map
automatically.

The only issue is whether there is a reason not to.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list