[GRASSLIST:9289] number of rows in a table?

I need to find the number of rows in a table. I have some vector files that crash qgis, yet grass opens them fine. Looking at the dbf files, I suspect the the issue is the file size (20 - 30 MB). I wanted to check the number of rows and I've been looking through the db commands, unfortunately, so far all I have come across is using using db.describe to get the number of columns. Any suggestions?

Thanks,

Kirk

On nie, 2005-12-04 at 09:24 -0600, Kirk Wythers wrote:

I need to find the number of rows in a table. I have some vector
files that crash qgis

Aren't them 3D shapefiles by any chance? These are not supported in
QGIS. I have had such a problem - QGIS crashing instead of saying "3D
shapefile not supported". Reported to QGIS crew but no reply yet.

Just a wild guess.

If this is not the case, please report your issue in Qgis bugtracker.

, yet grass opens them fine. Looking at the dbf
files, I suspect the the issue is the file size (20 - 30 MB). I
wanted to check the number of rows and I've been looking through the
db commands, unfortunately, so far all I have come across is using
using db.describe to get the number of columns. Any suggestions?

Don't know what Grass command but dbview will do.

Maciek

--------------------
W polskim Internecie s± setki milionów stron. My przekazujemy Tobie tylko najlepsze z nich!
http://katalog.epf.pl/

On Dec 4, 2005, at 7:24 AM, Kirk Wythers wrote:

I need to find the number of rows in a table. I have some vector files that crash qgis, yet grass opens them fine. Looking at the dbf files, I suspect the the issue is the file size (20 - 30 MB). I wanted to check the number of rows and I've been looking through the db commands, unfortunately, so far all I have come across is using using db.describe to get the number of columns. Any suggestions?

Thanks,

Kirk

try this

echo "select count(*) from table" | db.select

this should return the number of rows in table.

Cheers,

--
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341

Thanks for the suggestion. However, the command gives a DBF driver error:

GRASS 6.1.cvs (arrowhead_utm):~ > echo "select count(*) from allspecies83" | db.select
DBMI-DBF driver error:
SQL parser error in statement:
select count(*) from allspecies83

Error in db_open_select_cursor()

GRASS 6.1.cvs (arrowhead_utm):~ >

Am I missing something here?

Kirk

On Dec 4, 2005, at 1:59 PM, Dylan Beaudette wrote:

On Dec 4, 2005, at 7:24 AM, Kirk Wythers wrote:

I need to find the number of rows in a table. I have some vector files that crash qgis, yet grass opens them fine. Looking at the dbf files, I suspect the the issue is the file size (20 - 30 MB). I wanted to check the number of rows and I've been looking through the db commands, unfortunately, so far all I have come across is using using db.describe to get the number of columns. Any suggestions?

Thanks,

Kirk

try this

echo "select count(*) from table" | db.select

this should return the number of rows in table.

Cheers,

--
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341

>> I need to find the number of rows in a table. I have some vector
>> files that crash qgis, yet grass opens them fine. Looking at the
>> dbf files, I suspect the the issue is the file size (20 - 30 MB).
>> I wanted to check the number of rows and I've been looking through
>>
>> the db commands, unfortunately, so far all I have come across is
>> using using db.describe to get the number of columns. Any
>> suggestions?

as suggested, with dbview:

dbview -bt file.dbf | wc -l

perhaps with a grep thrown in and redirection to a > file.dat for subset
testing.

Hamish