[GRASS-user] v.dissolve and r.cost problems

Markus Neteler neteler at osgeo.org
Thu Apr 2 10:58:56 EDT 2009


On Thu, Apr 2, 2009 at 4:51 PM, Moritz Lennert
<mlennert at club.worldonline.be> wrote:
> On 02/04/09 16:00, Markus Neteler wrote:
>> On Thu, Apr 2, 2009 at 1:43 PM, Markus Neteler <neteler at osgeo.org> wrote:
>>> On Wed, Apr 1, 2009 at 6:05 PM, Paolo Cavallini <cavallini at faunalia.it>
>>>>
>>>> v.dissolve input=regiao at nuovo layer=1 column=REGIAO output=reg_diss
>>>> dbmi: Protocol error
...
>> Offlist we figured it out:
>> If the "REGIAO" column field value is empty, then it fails. Perhaps
>> only happening with char columns. Somewhere here:
>>
>>
>> http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/db/drivers/dbf/dbfexe.c#L644
>
> My wild guess would be that the problem is rather in the cmp_row_asc
> function, where you have on line 481:
>
>    case DBF_CHAR:
>        c1 = tbl->rows[*row1].values[cur_cmp_ocol].c;
>        c2 = tbl->rows[*row2].values[cur_cmp_ocol].c;
>        return (strcmp(c1, c2));
>        break;
>
> Don't know how strcmp handles empty values. Maybe you could add something
> like
>
> fprinf(stdout, "c1 = %s, c2 = %s\n", a, b);
>
> before the return statement to see the state of the respective character
> variables ?

Very good :)

echo "SELECT cat, REGIAO FROM regiao ORDER BY REGIAO" | db.select
D0/0: c1 = ALTO PORTUGAL, c2 = ALTO PORTUGAL
D0/0: c1 = NOROESTE CISMONTANO, c2 = ALTO PORTUGAL
D0/0: c1 = NOROESTE CISMONTANO, c2 = ALTO PORTUGAL
D0/0: c1 = NOROESTE CISMONTANO, c2 = ALTO PORTUGAL
D0/0: c1 = (null), c2 = ALTO PORTUGAL
dbmi: Protocol error

BAD happens when Null is found here.

Markus


More information about the grass-user mailing list