[GRASS5] Re: d.vect.thematic wish: handle null values

Moritz Lennert mlennert at club.worldonline.be
Thu Aug 11 18:53:33 EDT 2005


On Fri, August 12, 2005 0:13, Michael Barton said:
> I'm not sure that nulls are the problem. It won't accept the <= operator.
> Try straight > and < and see what happens. Also, what is FNR=1?

The operators are not defined by me but by d.vect.thematic.
The problem is not the <= operator, but the fact that in the sql statement

SELECT cat FROM ssbxl01 WHERE revmed >= 7 and revmed<=

there should be an integer after the <=.

This integer is missing because the awk script tries to divide by zero because
of the null values.

(FNR is an internal awk variable which stands for the "input record number in
the current input file")

I can confirm that it is the null values that are the problem since if I
replace them with any integer value (0, -99999, etc) d.vect.thematic runs
perfectly, but it creates the classes including the null-replacing integer
since it doesn't know that they are special values, and there is no way of
telling it this.

This is why I plead for one of the two solutions below...

Hope this helps clarifying the issue.

All the best,

Moritz


>
> Michael
> ______________________________
> Michael Barton, Professor of Anthropology
> School of Human Evolution and Social Change
> Arizona State University
> Tempe, AZ  85287-2402
> USA
>
> voice: 480-965-6262; fax: 480-965-7671
> www: http://www.public.asu.edu/~cmbarton
>
>
>> From: Moritz Lennert <mlennert at club.worldonline.be>
>> Reply-To: <mlennert at club.worldonline.be>
>> Date: Thu, 11 Aug 2005 23:20:00 +0200 (CEST)
>> To: Grass Developers List <grass5 at grass.itc.it>
>> Cc: <michael.barton at asu.edu>, <dcalvelo at minag.gob.pe>
>> Subject: d.vect.thematic wish: handle null values
>>
>> Hi,
>>
>> Trying to make maps with d.vect.thematic I have stumbled upon the problem
>> that
>> the module fails when there are null values in the table (postgresql):
>>
>> **********
>> awk: (FILENAME=- FNR=1) fatal: division by zero attempted
>>
>>
>> Thematic map legend for column revmed of map ssbxl01
>>
>> Value range:   -  33079
>> Mapped by 7 intervals of
>>
>> Color(R:G:B)    Value
>> ============    ==========
>> 0:0:250         7 -
>> DBMI-Postgres driver error:
>> Cannot select:
>> SELECT cat FROM ssbxl01 WHERE revmed >= 7 and revmed<=
>> ERREUR:  L'opérateur n'existe pas : integer <=
>> HINT:  Aucun opérateur correspond au nom donné et aux types d'arguments.
>> Vous
>> devez ajouter des conversions explicites de type.
>>
>>
>> 35:0:215                 -
>> DBMI-Postgres driver error:
>> Cannot select:
>> SELECT cat FROM ssbxl01 WHERE revmed >  and revmed<=
>> ERREUR:  syntax error sur ou près de «and» at character 41
>>
>> etc...
>> ************
>>
>> Now I can see two theoretical solutions to this:
>>
>> 1) handle null values
>> 2) allow to give a value that represents null values (e.g. -99999)
>>
>> For both of these solutions, d.vect.thematic should offer the choice of a
>> color for these values, so that they do not use the same color scheme as the
>> 'valid' values.
>>
>> Moritz
>>
>
> _______________________________________________
> grass5 mailing list
> grass5 at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass5
>





More information about the grass-dev mailing list