[GRASS-dev] Principle G3D library question

Maris Nartiss maris.gis at gmail.com
Tue Jun 21 07:58:57 EDT 2011


I would suggest to change grass7 to something not GRASS release dependent.

just my 0.02,
Maris.

2011/6/21 Soeren Gebbert <soerengebbert at googlemail.com>:
> Hi Maris,
> the new rater3d ascii header looks like this now:
>
> version: grass7
> order: nsbt
> north: 80.000000
> south: 0.000000
> east: 120.000000
> west: 0.000000
> top: 50.000000
> bottom: 0.000000
> rows: 8
> cols: 12
> levels: 5
>
> The options "version" and "order" are introduced with my changes on
> the g3d library in grass7. The manual page of the svn version of
> r3.out.ascii in grass7 explains a bit more.
>
> Best regards
> Soeren
>
> 2011/6/21 Maris Nartiss <maris.gis at gmail.com>:
>> (Still haven't looked at code) - I hope GRASS7 files will have a
>> version number in header to be future-proof.
>>
>> Maris.
>>
>> 2011/6/21 Soeren Gebbert <soerengebbert at googlemail.com>:
>>> Hi Maris,
>>>
>>> 2011/6/21 Maris Nartiss <maris.gis at gmail.com>:
>>>> Hello,
>>>> It's not an backporting of header it's about GRASS6 being able to
>>>> distinguish GRASS7 format g3d files. I have not peaked into code if
>>>> there such feature exists. If not, it should be implemented to prevent
>>>> GRASS6 failures (or worse - data corruption) on GRASS7 files.
>>>
>>> I see, good point!
>>>
>>> The grass6 implementation checks for valid header:
>>>
>>> static void readHeaderString(FILE * fp, char *valueString, double *value)
>>> {
>>>    static char format[100];
>>>
>>>    /* to avoid buffer overflows we use snprintf */
>>>    G_snprintf(format, 100, "%s %%lf", valueString);
>>>    if (fscanf(fp, format, value) != 1) {
>>>        G_debug(0, "bad value for [%s]", valueString);
>>>        fatalError("readHeaderString: header value invalid");
>>>    }
>>>    while (fgetc(fp) != '\n') ;
>>> }
>>>
>>> I think this should prevent the import of new grass7 volume ascii
>>> files in grass6. The grass6 import will break in when the new lines of
>>> the grass7 header are parsed.
>>>
>>> Best regards
>>> Soeren
>>>
>>
>


More information about the grass-dev mailing list