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

דור פרידמן dof1985 at gmail.com
Mon Apr 1 09:10:16 PDT 2013


Thanks Markus.

I've corrected my syntax, but have received a new error (it actually export
an empty file: 'nothing to export'), and the csv file is not being created.

That is my syntax:

> GRASS 7.0.svn (Israel):~ > db.out.ogr input=allpairs1
> dsn=/home/dof1985/Grass_projects/allpairs.csv format=CSV
> WARNING: 20167 line(s) found, but not requested to be exported. Verify
>          'type' parameter.
> Exported table </home/dof1985/Grass_projects/allpairs.csv.csv>
>
>
I have tried to export a map with two tables connected to it. Running
v.db.tables -p, I can see that there names are: allpairs1_1 and
allpairs_set10k. I would like to export both to either one or two csv files.

I have also attempted to export one table (allpairs1_1) to a distinct map
and exporting it, yet have received the same error and there was no file
creation.

Hope you could aid me with it,

Best,

Dor


2013/4/1 Markus Neteler <neteler at osgeo.org>

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20130401/1656b3f9/attachment.html>


More information about the grass-user mailing list