[FWTools] count(*) on tiger (was: using -sql with ogrinfo)
John Cole
john.cole at uai.com
Tue May 22 15:43:20 EDT 2007
Frank Warmerdam-2 wrote:
>
> John Cole wrote:
>> Hello,
>> I'm trying to select the number of records out of a tiger 2006se county
>> using a -sql query with ogrinfo.
>>
>> I'm getting the following error:
>>
>> C:\mapserver\tiger2006se\AL\TGR01001>ogrinfo . -sql 'SELECT * FROM
>> CompleteChain
>> '
>> ERROR 4: Tiger Driver doesn't support update.
>> Had to open data source read-only.
>> INFO: Open of `.'
>> using driver `TIGER' successful.
>> layer names ignored in combination with -sql.
>> ERROR 1: SQL: Missing FROM clause in SELECT statement.
>>
>> I'd like to get the number of roads out of the CompleteChain layer, so I
>> assume my query would look like:
>>
>> SELECT COUNT(fid) FROM CompleteChain WHERE cfcc LIKE "A%"
>>
>> but this too gets the above error.
>
> John,
>
> I *suspect* some sort of quoting issue at the windows commandline. If you
> can
> rule that out (perhaps by trying double quotes) then I'd encourage you to
> file a bug report, and I'll have Mateusz dig into it.
>
>
Frank,
I was able to track it down to quotes: on windows, you need the sql in
double quotes and the interior strings in single quotes.
Now for a different problem:
When I do a select count(*) from CompleteChains where cfcc like 'A%' I'm
getting a different row count than the shapefile of the roads for that
county. I suspect that I don't understand tiger correctly, because I was
able to confirm the number of rows in the RT1 file that had 'A%'.
If you were going to try and confirm that your shapfile had all of the
roads, how would you do it?
Thanks,
John
--
View this message in context: http://www.nabble.com/using--sql-with-ogrinfo-tf3790710.html#a10751079
Sent from the FWTools mailing list archive at Nabble.com.
More information about the FWTools
mailing list