[GRASS5] Re: [Fwd: ArcInfo ungenerate]

Michel Wurtz mw at teledetection.fr
Tue Apr 24 08:44:41 EDT 2001


Malcolm Blue wrote:
> 
> Markus,
> 
> I think that GENERATE format can include commas.  The following quote is from a
> response on the ESRI knowledge base describing how to create a GENERATE file from
> INFO:
> 
> 'The output file created will be used with the GENERATE
>         command, which will read commas as field delimiters. '
> 
> It appears either space or comma can be used.

Well... I spent a little time on v.in.arc : the problem is in
process_inp.c, which looks :

int process_inp (char *inp)
{
   G_remove_commas(inp);
   while(*inp)
   {
     if((*inp=='D')||(*inp=='d'))  *inp='e';
     inp++;
   }
   return 0;
}

G_remove_commas() appears only in v.in.arc and v.in.arc.pg (which is
based on v.in.arc).  the function is define in libes/gis/commas.c,
and the comment you found before the function is :

/* removes commas from strings representing a number 
	1,234,567    becomes 1234567
	1,234,567.89 becomes 1234567.89
	12,345       becomes 12345
	1234         stays   1234
*/

There is also a G_insert_commas() function for the opposite, that is a
little more used.  Here is the command i used from the grass/src dir :

bash-2.03$ find . -name '*.c' -exec grep G_insert_commas {} /dev/null \;
./src/libes/gis/commas.c:int G_insert_commas(
./src/libes/gis/edit_cellhd.c:    G_insert_commas(buf);
./src/raster/r.report/cmd/format.c:    G_insert_commas (temp);
./src.contrib/SCS/vector/v.report/cmd/format.c:    G_insert_commas (buf);

so it appears that

1- G_remove_commas() in never used except where it causes trouble
2- G_insert_commas() seems only used to put commas on rare occasions

Should we keep them in the future release, or modify
src/libes/gis/edit_cellhd.c, src/raster/r.report/cmd/format.c and
src.contrib/SCS/vector/v.report/cmd/format.c (which seems a duplicate
from the former)

In the meantime, I have modified src/mapdev/v.in.arc/process_inp.c
and src.garden/grass.postgresql/v.in.arc.pg/process_inp.c to
replace commas by spaces.  This should correct the problem.

--
Michel WURTZ - DIG - Maison de la télédétection
               500, rue J.F. Breton
               34093 MONTPELLIER Cedex 5

---------------------------------------- 
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'



More information about the grass-dev mailing list