[GRASS5] [bug #3277] (grass) d.vect.thematic fails with DOUBLE

this bug's URL: http://intevation.de/rt/webrt?serial_num=3277
-------------------------------------------------------------------------

Subject: d.vect.thematic fails with DOUBLE

Platform: GNU/Linux/i386
grass obtained from: Trento Italy site
grass binary for platform: Compiled from Sources
GRASS Version: cvs_25_05_05

d.vect.thematic works fine with INTEGER but fails with DOUBLE as follows:

d.vect.thematic map=gminy_zw_2003_prc_dem 'themetype=graduated colors' themecalc=interval column=PROD layer=1 type=area icon=basic/circle size=5 maxsize=20 nint=4 colorscheme=blue-red singlecolor=250:0:0 startcolor=250:0:0 endcolor=0:0:250 monitor=x1
awk: cmd. line:1: (FILENAME=- FNR=1) fatal: division by zero attempted

Thematic map legend for column PROD of map gminy_zw_2003_prc_dem

Value range: -
Mapped by 4 intervals of

Color(R:G:B) Value
============ ==========
0:0:250 . -
DBMI-DBF driver error:
SQL parser error in statement:
SELECT cat FROM gminy_zw_2003_prc_dem WHERE PROD >= and PROD<=
Error in db_open_select_cursor()

62:0:188 . -
DBMI-DBF driver error:
SQL parser error in statement:
SELECT cat FROM gminy_zw_2003_prc_dem WHERE PROD > and PROD<=
Error in db_open_select_cursor()

124:0:126 . -
DBMI-DBF driver error:
SQL parser error in statement:
SELECT cat FROM gminy_zw_2003_prc_dem WHERE PROD > and PROD<=
Error in db_open_select_cursor()

186:0:64 . -
DBMI-DBF driver error:
SQL parser error in statement:
SELECT cat FROM gminy_zw_2003_prc_dem WHERE PROD > and PROD<=
Error in db_open_select_cursor()

---

the vector file info:

GRASS 6.1.cvs (caves_utm33):~ > v.info gminy_zw_2003_prc_dem
+----------------------------------------------------------------------------+
| Layer: gminy_zw_2003_prc_dem Organization: |
| Mapset: admin Source Date: |
| Location: caves_utm33 Name of creator: |
| Database: /home/grassdata |
| Title: |
| Map Scale: 1:1 |
| Map format: native |
|----------------------------------------------------------------------------|
| Type of Map: Vector (level: 2) |
| |
| Number of points: 0 Number of areas: 23 |
| Number of lines: 0 Number of islands: 5 |
| Number of boundaries: 90 Number of faces: 0 |
| Number of centroids: 23 Number of kernels: 0 |
| |
| Map is 3D: 0 |
| Number of dblinks: 1 |
| |
| Projection: Universe Transverse Mercator (zone 33) |
| N: 5739296.326 S: 5660045.543 |
| E: 633165.320 W: 564573.435 |
| B: 0.000 T: 0.000 |
| |
| Digitize threshold: 0.00000 |
| Comments: |
| |
+----------------------------------------------------------------------------+

datbase info:

db.describe table=gminy_zw_2003_prc_dem driver=dbf database=$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
table:gminy_zw_2003_prc_dem
description:
insert:yes
delete:yes
ncols:14

column:CAT
description:
type:INTEGER
len:11
scale:0
precision:10
default:0
nullok:yes
select:yes
update:yes

column:NAZWA
description:
type:CHARACTER
len:15
scale:0
precision:0
default:
nullok:yes
select:yes
update:yes

column:PRZYR_PRC
description:
type:DOUBLE PRECISION
len:5
scale:2
precision:3
default:0.000000
nullok:yes
select:yes
update:yes

column:PRZEDPR
description:
type:DOUBLE PRECISION
len:8
scale:2
precision:6
default:0.000000
nullok:yes
select:yes
update:yes

column:PROD
description:
type:DOUBLE PRECISION
len:8
scale:2
precision:6
default:0.000000
nullok:yes
select:yes
update:yes

column:POPROD
description:
type:DOUBLE PRECISION
len:7
scale:2
precision:5
default:0.000000
nullok:yes
select:yes
update:yes

column:PRAC
description:
type:DOUBLE PRECISION
len:8
scale:2
precision:6
default:0.000000
nullok:yes
select:yes
update:yes

column:PRAC_ROL
description:
type:DOUBLE PRECISION
len:6
scale:2
precision:4
default:0.000000
nullok:yes
select:yes
update:yes

column:BEZR_REJ
description:
type:DOUBLE PRECISION
len:7
scale:2
precision:5
default:0.000000
nullok:yes
select:yes
update:yes

column:ZATR
description:
type:DOUBLE PRECISION
len:5
scale:2
precision:3
default:0.000000
nullok:yes
select:yes
update:yes

column:NIEZATR
description:
type:DOUBLE PRECISION
len:5
scale:2
precision:3
default:0.000000
nullok:yes
select:yes
update:yes

column:GESTOSC
description:
type:DOUBLE PRECISION
len:7
scale:2
precision:5
default:0.000000
nullok:yes
select:yes
update:yes

column:WIES_KM2
description:
type:DOUBLE PRECISION
len:4
scale:2
precision:2
default:0.000000
nullok:yes
select:yes
update:yes

column:grassrgb
description:
type:CHARACTER
len:11
scale:0
precision:0
default:
nullok:yes
select:yes
update:yes

Maciek

-------------------------------------------- Managed by Request Tracker

hi,
this should be solved by

    export LC_NUMERIC=C

at line 167 of d.vect.thematic ...

is you d.vect.thematic not a bit older?

Jáchym

On Wed, May 25, 2005 at 11:47:05AM +0200, Request Tracker wrote:

this bug's URL: http://intevation.de/rt/webrt?serial_num=3277
-------------------------------------------------------------------------

Subject: d.vect.thematic fails with DOUBLE

Platform: GNU/Linux/i386
grass obtained from: Trento Italy site
grass binary for platform: Compiled from Sources
GRASS Version: cvs_25_05_05

d.vect.thematic works fine with INTEGER but fails with DOUBLE as follows:

d.vect.thematic map=gminy_zw_2003_prc_dem 'themetype=graduated colors' themecalc=interval column=PROD layer=1 type=area icon=basic/circle size=5 maxsize=20 nint=4 colorscheme=blue-red singlecolor=250:0:0 startcolor=250:0:0 endcolor=0:0:250 monitor=x1
awk: cmd. line:1: (FILENAME=- FNR=1) fatal: division by zero attempted

Thematic map legend for column PROD of map gminy_zw_2003_prc_dem

Value range: -
Mapped by 4 intervals of

Color(R:G:B) Value
============ ==========
0:0:250 . -
DBMI-DBF driver error:
SQL parser error in statement:
SELECT cat FROM gminy_zw_2003_prc_dem WHERE PROD >= and PROD<=
Error in db_open_select_cursor()

62:0:188 . -
DBMI-DBF driver error:
SQL parser error in statement:
SELECT cat FROM gminy_zw_2003_prc_dem WHERE PROD > and PROD<=
Error in db_open_select_cursor()

124:0:126 . -
DBMI-DBF driver error:
SQL parser error in statement:
SELECT cat FROM gminy_zw_2003_prc_dem WHERE PROD > and PROD<=
Error in db_open_select_cursor()

186:0:64 . -
DBMI-DBF driver error:
SQL parser error in statement:
SELECT cat FROM gminy_zw_2003_prc_dem WHERE PROD > and PROD<=
Error in db_open_select_cursor()

---

the vector file info:

GRASS 6.1.cvs (caves_utm33):~ > v.info gminy_zw_2003_prc_dem
+----------------------------------------------------------------------------+
| Layer: gminy_zw_2003_prc_dem Organization: |
| Mapset: admin Source Date: |
| Location: caves_utm33 Name of creator: |
| Database: /home/grassdata |
| Title: |
| Map Scale: 1:1 |
| Map format: native |
|----------------------------------------------------------------------------|
| Type of Map: Vector (level: 2) |
| |
| Number of points: 0 Number of areas: 23 |
| Number of lines: 0 Number of islands: 5 |
| Number of boundaries: 90 Number of faces: 0 |
| Number of centroids: 23 Number of kernels: 0 |
| |
| Map is 3D: 0 |
| Number of dblinks: 1 |
| |
| Projection: Universe Transverse Mercator (zone 33) |
| N: 5739296.326 S: 5660045.543 |
| E: 633165.320 W: 564573.435 |
| B: 0.000 T: 0.000 |
| |
| Digitize threshold: 0.00000 |
| Comments: |
| |
+----------------------------------------------------------------------------+

datbase info:

db.describe table=gminy_zw_2003_prc_dem driver=dbf database=$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
table:gminy_zw_2003_prc_dem
description:
insert:yes
delete:yes
ncols:14

column:CAT
description:
type:INTEGER
len:11
scale:0
precision:10
default:0
nullok:yes
select:yes
update:yes

column:NAZWA
description:
type:CHARACTER
len:15
scale:0
precision:0
default:
nullok:yes
select:yes
update:yes

column:PRZYR_PRC
description:
type:DOUBLE PRECISION
len:5
scale:2
precision:3
default:0.000000
nullok:yes
select:yes
update:yes

column:PRZEDPR
description:
type:DOUBLE PRECISION
len:8
scale:2
precision:6
default:0.000000
nullok:yes
select:yes
update:yes

column:PROD
description:
type:DOUBLE PRECISION
len:8
scale:2
precision:6
default:0.000000
nullok:yes
select:yes
update:yes

column:POPROD
description:
type:DOUBLE PRECISION
len:7
scale:2
precision:5
default:0.000000
nullok:yes
select:yes
update:yes

column:PRAC
description:
type:DOUBLE PRECISION
len:8
scale:2
precision:6
default:0.000000
nullok:yes
select:yes
update:yes

column:PRAC_ROL
description:
type:DOUBLE PRECISION
len:6
scale:2
precision:4
default:0.000000
nullok:yes
select:yes
update:yes

column:BEZR_REJ
description:
type:DOUBLE PRECISION
len:7
scale:2
precision:5
default:0.000000
nullok:yes
select:yes
update:yes

column:ZATR
description:
type:DOUBLE PRECISION
len:5
scale:2
precision:3
default:0.000000
nullok:yes
select:yes
update:yes

column:NIEZATR
description:
type:DOUBLE PRECISION
len:5
scale:2
precision:3
default:0.000000
nullok:yes
select:yes
update:yes

column:GESTOSC
description:
type:DOUBLE PRECISION
len:7
scale:2
precision:5
default:0.000000
nullok:yes
select:yes
update:yes

column:WIES_KM2
description:
type:DOUBLE PRECISION
len:4
scale:2
precision:2
default:0.000000
nullok:yes
select:yes
update:yes

column:grassrgb
description:
type:CHARACTER
len:11
scale:0
precision:0
default:
nullok:yes
select:yes
update:yes

Maciek

-------------------------------------------- Managed by Request Tracker

_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5

--
Jachym Cepicky
e-mail: jachym.cepicky@centrum.cz
URL: http://les-ejk.cz
GPG: http://www.fle.czu.cz/~jachym/gnupg_public_key/

Could someone else test this with the current version? I've tested it by
updating an "area" column with values via v.to.db. This provides non-integer
values in a dbf format. However, the native dbf format doesn't explicitly
support double precision numbers the way another dbms might.

Since this is done as intervals, there are no statistical calculations done
in v.univar.sh except for maximum and minimum. I've done all the
calculations for thematic mapping in awk. The only thing I can think of is
that there are some records have empty (i.e., NOT 0, but empty or null)
values for the field. Something along this line happened when I was testing
it against the Spearfish roads table. The 'nodata' record had nothing in it
for length. When I opened the table and resaved it, it changed to 0. Then it
calculated OK. Currently, this does not handle null or empty values. It
would take a rewrite of v.univar.sh to do so, along with a way to specify
them.

If this is not the problem, I'm baffled as to why this is creating an error.
Could anyone else offer ideas?

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: Request Tracker <grass-bugs@intevation.de>
Reply-To: Request Tracker <grass-bugs@intevation.de>
Date: Wed, 25 May 2005 11:47:05 +0200 (CEST)
To: <grass5@grass.itc.it>
Subject: [GRASS5] [bug #3277] (grass) d.vect.thematic fails with DOUBLE

this bug's URL: http://intevation.de/rt/webrt?serial_num=3277
-------------------------------------------------------------------------

Subject: d.vect.thematic fails with DOUBLE

Platform: GNU/Linux/i386
grass obtained from: Trento Italy site
grass binary for platform: Compiled from Sources
GRASS Version: cvs_25_05_05

d.vect.thematic works fine with INTEGER but fails with DOUBLE as follows:

d.vect.thematic map=gminy_zw_2003_prc_dem 'themetype=graduated colors'
themecalc=interval column=PROD layer=1 type=area icon=basic/circle size=5
maxsize=20 nint=4 colorscheme=blue-red singlecolor=250:0:0 startcolor=250:0:0
endcolor=0:0:250 monitor=x1
awk: cmd. line:1: (FILENAME=- FNR=1) fatal: division by zero attempted

Thematic map legend for column PROD of map gminy_zw_2003_prc_dem

Value range: -
Mapped by 4 intervals of

Color(R:G:B) Value
============ ==========
0:0:250 . -
DBMI-DBF driver error:
SQL parser error in statement:
SELECT cat FROM gminy_zw_2003_prc_dem WHERE PROD >= and PROD<=
Error in db_open_select_cursor()

62:0:188 . -
DBMI-DBF driver error:
SQL parser error in statement:
SELECT cat FROM gminy_zw_2003_prc_dem WHERE PROD > and PROD<=
Error in db_open_select_cursor()

124:0:126 . -
DBMI-DBF driver error:
SQL parser error in statement:
SELECT cat FROM gminy_zw_2003_prc_dem WHERE PROD > and PROD<=
Error in db_open_select_cursor()

186:0:64 . -
DBMI-DBF driver error:
SQL parser error in statement:
SELECT cat FROM gminy_zw_2003_prc_dem WHERE PROD > and PROD<=
Error in db_open_select_cursor()

---

the vector file info:

GRASS 6.1.cvs (caves_utm33):~ > v.info gminy_zw_2003_prc_dem

+----------------------------------------------------------------------------+
| Layer: gminy_zw_2003_prc_dem Organization:
|
| Mapset: admin Source Date:
|
| Location: caves_utm33 Name of creator:
|
| Database: /home/grassdata
|
| Title:
|
| Map Scale: 1:1
|
| Map format: native
|

|----------------------------------------------------------------------------|
| Type of Map: Vector (level: 2)
|
|
|
| Number of points: 0 Number of areas: 23
|
| Number of lines: 0 Number of islands: 5
|
| Number of boundaries: 90 Number of faces: 0
|
| Number of centroids: 23 Number of kernels: 0
|
|
|
| Map is 3D: 0
|
| Number of dblinks: 1
|
|
|
| Projection: Universe Transverse Mercator (zone 33)
|
| N: 5739296.326 S: 5660045.543
|
| E: 633165.320 W: 564573.435
|
| B: 0.000 T: 0.000
|
|
|
| Digitize threshold: 0.00000
|
| Comments:
|
|
|

+----------------------------------------------------------------------------+

datbase info:

db.describe table=gminy_zw_2003_prc_dem driver=dbf
database=$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
table:gminy_zw_2003_prc_dem
description:
insert:yes
delete:yes
ncols:14

column:CAT
description:
type:INTEGER
len:11
scale:0
precision:10
default:0
nullok:yes
select:yes
update:yes

column:NAZWA
description:
type:CHARACTER
len:15
scale:0
precision:0
default:
nullok:yes
select:yes
update:yes

column:PRZYR_PRC
description:
type:DOUBLE PRECISION
len:5
scale:2
precision:3
default:0.000000
nullok:yes
select:yes
update:yes

column:PRZEDPR
description:
type:DOUBLE PRECISION
len:8
scale:2
precision:6
default:0.000000
nullok:yes
select:yes
update:yes

column:PROD
description:
type:DOUBLE PRECISION
len:8
scale:2
precision:6
default:0.000000
nullok:yes
select:yes
update:yes

column:POPROD
description:
type:DOUBLE PRECISION
len:7
scale:2
precision:5
default:0.000000
nullok:yes
select:yes
update:yes

column:PRAC
description:
type:DOUBLE PRECISION
len:8
scale:2
precision:6
default:0.000000
nullok:yes
select:yes
update:yes

column:PRAC_ROL
description:
type:DOUBLE PRECISION
len:6
scale:2
precision:4
default:0.000000
nullok:yes
select:yes
update:yes

column:BEZR_REJ
description:
type:DOUBLE PRECISION
len:7
scale:2
precision:5
default:0.000000
nullok:yes
select:yes
update:yes

column:ZATR
description:
type:DOUBLE PRECISION
len:5
scale:2
precision:3
default:0.000000
nullok:yes
select:yes
update:yes

column:NIEZATR
description:
type:DOUBLE PRECISION
len:5
scale:2
precision:3
default:0.000000
nullok:yes
select:yes
update:yes

column:GESTOSC
description:
type:DOUBLE PRECISION
len:7
scale:2
precision:5
default:0.000000
nullok:yes
select:yes
update:yes

column:WIES_KM2
description:
type:DOUBLE PRECISION
len:4
scale:2
precision:2
default:0.000000
nullok:yes
select:yes
update:yes

column:grassrgb
description:
type:CHARACTER
len:11
scale:0
precision:0
default:
nullok:yes
select:yes
update:yes

Maciek

-------------------------------------------- Managed by Request Tracker