[GRASS-user] Change column data format from double precision to integer

Rich Shepard rshepard at appl-ecosys.com
Tue Oct 5 13:02:40 PDT 2021


On Tue, 5 Oct 2021, Micha Silver wrote:

> AFAIK coordinates in GRASS (including the z coord) are always DOUBLE. The
> v.in.ascii function reads the x,y,z columns as DOUBLE.

Micha,

How interesting! In this project the depths are in integers but display as
double

> # However, no database connection defined:

Yes, I noticed this, too. The shape files for the same points, imported with
v.in.ogr, do come with a database table. I was going to provide a couple of
samples and ask about this but you've answered my question.

> # Now add a new INTEGER column
> v.db.addcolumn p1 column="z_int INTEGER"
> v.db.update p1 column=z_int query_col="CAST(elev as INTEGER)"

> I think that is what you wanted.

Yep. That it is. Saves my time creating examples to get this same knowledge.

Thanks,

Rich


More information about the grass-user mailing list