[GRASS-dev] Vectlib: delete broken vectors upon creation failure?

Markus Neteler neteler at itc.it
Mon Jul 3 18:01:45 EDT 2006


On Mon, Jul 03, 2006 at 05:27:00AM -0500, Huidae Cho wrote:
> Is there any way to know from the library if a map has not been completely
> imported?  IMHO, incomplete import is different from corrupted files (well
> sometimes it could mean broken vectors), so only modules importing files can
> determine to remove incomplete vectors.

OK.
I have added a couple of Vect_delete() calls to v.in.ascii before
G_fatal_error() happens. Like this cruft is removed before the
error message appears.

Markus
 
> Huidae Cho
> 
> 
> On Mon, Jul 03, 2006 at 08:46:22AM +0200, Markus Neteler wrote:
> > Hi,
> > 
> > Huidae had added the nice feature in v.in.dxf (now functional, I guess)
> > that a broken vector map is immediately removed when import wasn't
> > successful and is not left behind.
> > 
> > This is an issue which affects various modules. I think we should
> > add this somehow to the vector library since broken vector maps
> > aren't really useful. The tmp file approach of raster maps is
> > more failsafe here. Since tmp doesn't exist for vector maps,
> > any ideas how to implement that?
> > At least v.in.ascii needs it, maybe also v.in.ogr.
> > 
> > Markus
> > 
> > 
> > On Mon, Jul 03, 2006 at 02:35:32AM +0200, grass at intevation.de wrote:
> > > Index: main.c
> > > ===================================================================
> > > RCS file: /grassrepository/grass6/vector/v.in.dxf/main.c,v
> > > retrieving revision 1.35
> > > retrieving revision 1.36
> > > diff -u -d -r1.35 -r1.36
> > > --- main.c	12 Jun 2006 05:42:40 -0000	1.35
> > > +++ main.c	3 Jul 2006 00:35:30 -0000	1.36
> > > @@ -179,6 +179,8 @@
> > >  	    }
> > >  	}
> > >  	else {
> > > +	    G_warning(_
> > > +		      ("Failed to import DXF file! The created vector file will be deleted."));
> > >  	    fprintf(stderr, "REMOVE [%s]\n", output);
> > >  	    Vect_delete(output);
> > >  	}
> > 
> > _______________________________________________
> > grass-dev mailing list
> > grass-dev at grass.itc.it
> > http://grass.itc.it/mailman/listinfo/grass-dev
> 
> _______________________________________________
> grass-dev mailing list
> grass-dev at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev

-- 
Markus Neteler  <neteler itc it>  http://mpa.itc.it/markus/
ITC-irst -  Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18        -       38050 Povo (Trento), Italy




More information about the grass-dev mailing list