[GRASS-user] v.in.ascii with undefined columns?

Moritz Lennert mlennert at club.worldonline.be
Fri Sep 4 06:34:01 PDT 2015


Le Thu, 3 Sep 2015 16:33:58 +0200,
"patrick s." <patrick_gis at gmx.net> a écrit :

> As Alternative the db.in.ogr-command allows to load csv-files into 
> GRASS, but misses the option to create spatial points out of the 
> coordinates. 

Check out v.in.db for that step.

> Furthermore this might need guidance on the data-type 
> through a .csvt-file (see manual db.in.ogr).

If you want to make sure you get the correct datatypes then this is a
necessary step (or the equivalent columns= parameter of v.in.ascii).
Most tools that try to guess the datatype might do a reasonably good
job, but almost never 100% correct.

Once you have a .csvt file.

Actually very recent GDAL (2.1) allows you to directly ask for
automatic type definition and specify possible names for coordinate
columns (see [1]). You can then use an ogr2ogr one-liner to translate
into a format that GRASS can import without losing this info. (Ideally
v.in.ogr/r.in.gdal should allow the specification of gdal open options
just as v.out.ogr/r.out.gdal allow to specify layer creation options.
Probably worth a wish in trac.

Moritz


More information about the grass-user mailing list