Thu, Feb 15 2001
17:45:11
|
|
Request created by guest
|
|
Subject: v.reclass.pg
Platform: Linux/Intel
Linux distro:: Debian
linux cpu:: Intel (i486, i586, pentium ...)
Xwindows version:: Xfree 4.0.x
Xwindows manager:: WindowMaker
TclTk version:: tcl/tk 8.3
grass downloaded at:: CVS Server, Germany
grass binary for platform:: I compiled the sources myself
grass sources source:: yes, I am using the latest GRASS from CVS
c compiler name:: gcc
Trying to run v.reclass.pg on the command line with
v.reclass.pg -s sql=recl.sql input=world2 output=test type=area
and recl.sql containing a simple statement like:
select distinct grass_id
from categories
where valeur > 55
I get the following error message and a segmentation fault :
PQgetvalue: ERROR! field number 1 is out of range 0..0 |
|
Tue, May 15 2001
23:09:51
|
|
Subject changed to v.reclass.pg: field number 1 is out of range 0..0 by mneteler
|
|
Fri, May 25 2001
19:28:39
|
|
Comments added by guest
|
|
Cc:
mlennert@club.worldonline.be
This issue relates to one I just posted.
v.reclass.pg doesn't actually behave as its man page claims.
A look at the source code shows that v.reclass.pg expects the sql file to
contain one select statement, and expects that select to return pairs of
values to be turned into a set of reclass rules for v.reclass.
Your sql statement returns only one field. In the code, the fields are
accessed with calls to PQgetvalue(result,rownumber,0) for the first field, and
PQgetvalue(result,rownumber,1) for the second. For your select, there *is* no
field 1, so the range of valid values for the third argument of PQgetvalue is
0 to 0. That's what your error message means.
To make your sql statement work you need to return a second field in addition
to the feature id, for example
select fid,category from object_database where road_type='bigfrigginhiway';
this will be turned into a temporary file for v.reclass that looks like
100 = 5
200 = 6
310 = 5
etc, where the first column is fid and the second column is category.
Hope that helps.
|
|
Sat, Dec 22 2001
09:32:19
|
|
Status changed to resolved by ashevlakov
|
|