[GRASS-dev] d.vect -a shows only some elements
Moritz Lennert
mlennert at club.worldonline.be
Fri Oct 20 13:23:37 EDT 2006
Moritz Lennert wrote:
> Hamish wrote:
>> Moritz Lennert wrote:
>>> Using d.vect.thematic -u I fill a grassrgb column in the attribute
>>> table. See http://moritz.homelinux.org/grass/d_vect_a1.png.
>>>
>>> But when I try to reuse these colors with d.vect -a, only a few of the
>>>
>>> regions get filled (with an additional dissolution of common
>>> boundaries): http://moritz.homelinux.org/grass/d_vect_a2.png
>>>
>>> All of the objects in the map have a color code in the grassrgb
>>> column.
>>>
>>> I cannot reproduce this problem in spearfish, so I am a bit lost.
>>>
>>> Any ideas ?
>>
>>
>> "with an additional dissolution of common boundaries" is causing the
>> problem.
>>
>> dissolution is based on common cat, but thematic colors are based on
>> "jk" column. areas with a common cat can have different attribute
>> values.
>>
>> e.g. if cat refers to country number, and attr col refers to province
>> area.
>
> This is not it. The dissolution came from the simple fact, that I used
> 'd.vect type=area' instead of d.vect type=area,boundary. Sorry, I didn't
> realize this before.
>
> So I still have:
>
> GRASS 6.3.cvs (ESPON):~ > psql -d espon -c "select * from temp where
> grassrgb is NULL"
> cat | nuts2 | jk | dkdldm | ab | lmn | grassrgb
> -----+-------+----+--------+----+-----+----------
> (0 lignes)
>
> and
>
> GRASS 6.3.cvs (ESPON):~ > psql -d espon -c "select distinct grassrgb
> from temp"
> grassrgb
> ----------
> 0:0:255
> 170:0:85
> 255:0:0
> 85:0:170
>
> So, the grassrgb column is filled as it should. To make sure there is
> not problem with the colours, I do a seperate d.vect for each range.
> This works perfectly: http://moritz.homelinux.org/grass/d_vect_a1.png
>
> But trying to reproduce this with d.vect -a, I get:
> http://moritz.homelinux.org/grass/d_vect_a2.png.
>
> As you can see, those regions that are colored, are colored correctly,
> but not all regions are colored. If I change the color scheme, I get
> exactly the same results: http://moritz.homelinux.org/grass/d_vect_a3.png
>
> It is as if d.vect stopped coloring at one point.
> ..
>
> If I display the map in four d.vect calls with where='grassrgb=255:0:0',
> etc, it displays fine.
>
> I also get the same problem if I use d.vect.thematic on the cat column...
>
I have done some testing, and the problem seems to be in line 224 of
display/d.vect/area.c:
if (db_CatValArray_get_value (&cvarr_rgb, cat, &cv_rgb) != DB_OK)
db_CatValArray_get_value returns 'not found' for many of the cat values.
I am wondering whether this might be due to the fact that the bsearch in
db_CatValArray_get_value needs a sorted array, but that the array is not
sorted as db_select_CatValArray() which creates the array on line 67 of
the same file only sorts lists of ints or doubles, but not of strings...
Moritz
More information about the grass-dev
mailing list