Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#3236 closed defect (fixed)

v.db.select mixes areas and other geometries resulting in a wrong region

Reported by: marisn Owned by: grass-dev@…
Priority: major Milestone: 7.2.1
Component: Vector Version: svn-trunk
Keywords: v.db.select Cc:
CPU: Unspecified Platform: Unspecified

Description

v.db.select with option "print region" calls Vect_cidx_find_all with type mask -1. This type mask matches lines and areas (see #3235). As a result - output of it will be IDs of lines and IDs of areas. Subsequent calls to Vect_get_line_type and Vect_get_line_box assume that Vect_cidx_find_all has returned only line IDs and thus will read wrong line for matching areas. The solution would be to change type mask to read "~GV_AREA" instead of "-1".

I have not commited this as I would like if someone with greater understanding of CIDX to take a look at it at first (together with #3235). Here is sample data to test the issue. In both cases output should be identical, still, as you can see, for "bad" map it is wrong.

echo "ORGANIZATION: Maris N
DIGIT DATE:   01/01/2017
DIGIT NAME:   -
MAP NAME:     fail
MAP DATE:     2017
MAP SCALE:    10000
OTHER INFO:   Test polygons
ZONE:  0
MAP THRESH:   0.500000
VERTI:
B 4
 15 10
 10 10
 10 15
 15 15
C 1 1
 12 12
 1 3
C 1 1
 17 12
 1 4
B 4
 15 10
 20 10
 20 15
 15 15
B 2
 15 10
 15 15
" | v.in.ascii in=- format=standard output=bad --o
v.db.addtable map=bad

echo "ORGANIZATION: Maris N
DIGIT DATE:   01/01/2017
DIGIT NAME:   -
MAP NAME:     success
MAP DATE:     2017
MAP SCALE:    10000
OTHER INFO:   Test polygons
ZONE:  0
MAP THRESH:   0.500000
VERTI:
B 4
 15 10
 10 10
 10 15
 15 15
B 4
 15 10
 20 10
 20 15
 15 15
B 2
 15 10
 15 15
C 1 1
 12 12
 1 3
C 1 1
 17 12
 1 4
" | v.in.ascii in=- format=standard output=good --o
v.db.addtable map=good

v.db.select -r map=good where=CAT=4
v.db.select -r map=bad where=CAT=4

Change History (3)

comment:1 by mmetz, 7 years ago

Resolution: fixed
Status: newclosed

In 70406:

v.db.select: fix #3236

comment:2 by mmetz, 7 years ago

In 70407:

v.db.select: fix #3236 (backport from trunk r70406)

comment:3 by mmetz, 7 years ago

In 70408:

v.db.select: fix #3236 (backport from trunk r70406)

Note: See TracTickets for help on using tickets.