Current map displayed is Pit_Lakes@pit_lakes. I want to export the 42 rows
in the table and followed the example on the manual page:
GRASS 7.7.svn:~/data/grassdata/Nevada/BMRR > db.out.ogr in=Pit_Lakes
out=pit_lakes.csv
ERROR: File <Pit_Lakes.dbf> already exists
I am not seeing what error I made and would appreciate being shown what I've
done incorrectly.
TIA,
Rich
On Wed, 27 Feb 2019, Micha Silver wrote:
Looking at the source code for db.out.ogr, I see that this module has a
somewhat strange approach to checking for the overwrite flag. There is a
test for existence of a file with the same name as the GRASS *input*
layer, but with .dbf extension. If such a file exists, the module fails,
as you saw.
Micha,
Wow! It would never have occurred to me that --o was needed! Because
v.out.ogr is supposed to have a .dbf for input (as the default), and the
output was specified as .csv there could not be any overwritten file.
Besides, the purpose of the module is to _export_ rows from the database
file, not overwrite the table.
From your detailed look at the source code I suggest a clean up that would
prevent the output file having the same extension as the input file (despite
that making no sense at all) and letting the rest work as expected.
In your case, you could get around the issue by simply adding the
overwrite flag to your command. Since you're saving to a *.csv, there's no
danger of overwriting any existing dbf.
Yes, I'll do this. Thanks very much for taking the time to find this quirk.
Best regards,
Rich
On Wed, 27 Feb 2019, Micha Silver wrote:
I should add to my previous message that if you specify 'dbf' format the
script will delete all other components of an existing shapefile (by the
same name).
Micha,
Wait. Why does db.out.ogr allow the output file to be another database? How
often would someone want to do this?
Related question: the format option is required, but to the input or output?
Look at the first example. It has an input and output but no format.
I've not before used db.out.ogr so you've taught ma a lot.
Best regards,
Rich