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

Markus Neteler neteler at osgeo.org
Fri Apr 3 02:43:30 EDT 2009


On Thu, Apr 2, 2009 at 6:37 PM, Moritz Lennert
<mlennert at club.worldonline.be> wrote:
> On 02/04/09 18:12, Moritz Lennert wrote:
>> On 02/04/09 16:58, Markus Neteler wrote:
>>> On Thu, Apr 2, 2009 at 4:51 PM, Moritz Lennert
>>>> On 02/04/09 16:00, Markus Neteler wrote:
>>>>> On Thu, Apr 2, 2009 at 1:43 PM, Markus Neteler <neteler at osgeo.org>
>>>>>> On Wed, Apr 1, 2009 at 6:05 PM, Paolo Cavallini
>>>>>>> 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.
...
>>> BAD happens when Null is found here.
>>
>> And that's arguably a correct behaviour as how should NULL be handled in
>> such a comparison ? Don't know how it is dealt with in other DBMS...

Yes, I also don't know...

>> So, before we fix this in any way, we should probably agree to how to
>> handle it. One possible way would be to check for nulls and if there are any
>> to assign a return value according to our choice as to where to sort nulls
>> to. Don't know how to check for an uninitialised char variable in C, but I
>> imagine that it should be possible.
>
> Actually, you should be able to check
> tbl->rows[*row1].values[cur_cmp_ocol].is_null
>
> and deal with the values accordingly, but from a casual glimpse I cannot
> find the possible values of is_null... I suppose 0 for false and 1 for true,
> but not sure...Use your example to check, with something like
>
> fprintf(stdout, "row 1 null status = %i\n", tbl->rows[*row1].values[cur_cmp_ocol].is_null);

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

Seems to be found.

Markus


More information about the grass-user mailing list