[GRASS-user] Using db.out.ogr to export attributes to a csv file

Markus Neteler neteler at osgeo.org
Mon Apr 1 08:38:36 PDT 2013


On Mon, Apr 1, 2013 at 5:08 PM, דור פרידמן <dof1985 at gmail.com> wrote:
> Hi all,
>
> I'm trying to use db.out.ogr to export an attributes table to a csv format
> for excel. I am using GRASS 7, but not sure what to put in the "dsn="
> syntax.

The dsn parameter is the path + filename to the *output* file.

> This is the command I have used and the error that has appeared. Further
> when the file will be created, where can I find it?
>
>> db.out.ogr input=distance1
>> dsn=/home/dof1985/Grass_projects/Waste/Israel/CD-waste/sqlite/sqlite.db
>> format=CSV table=shortest_distance

Apparently you try to overwrite the internal GRASS database... better don't :-)

See the second example in the manual:
http://grass.osgeo.org/grass64/manuals/db.out.ogr.html

The dsn parameter should point to the output CSV file:

db.out.ogr input=distance1 dsn=/home/dof1985/shortest_distance.csv format=CSV

I agree that it is a bit confusing, since the db_table parameter should not
be used in this case (only if you write the output to a database system).

Essentially we follow the logic of GDAL/OGR here.

Since we are in GRASS 7 (where we may change parameters), I would not
mind to see a more intuitive solution here.

Dor, others: meanwhile manual improvements would be welcome (text
snippets to add to the manual).

Markus


More information about the grass-user mailing list