[GRASS-user] changing collumn type on vector map

Dear all,

I just imported a shapefile on GRASS, and I need to convert several fields from CHAR to numeric (double precision) - at my own risk, of course.
Can I do it on grass, or I need to redo the thinks on arcgis ?!

bests

milton
brazil=toronto

On 02/07/09 18:52, Milton Cezar Ribeiro wrote:

Dear all,
I just imported a shapefile on GRASS, and I need to convert several fields from CHAR to numeric (double precision) - at my own risk, of course.
Can I do it on grass, or I need to redo the thinks on arcgis ?!

Depends on your database backend. In PostgreSQL (and perhaps SQLite), you could do something like this:

echo "alter table XYZ alter column ABC type numeric" | db.execute

I don't think anything like this would be possible in dbf...

You could also try a combination of v.db.addcol + v.db.update to create new numeric columns and set the value of these columns to the value of the varchar column.

Moritz

Hi Moritz,

As I am using dbf, with v.db.addcol + v.db.update it is running find.

Thanks!

milton

2009/7/2 Moritz Lennert <mlennert@club.worldonline.be>

On 02/07/09 18:52, Milton Cezar Ribeiro wrote:

Dear all,
I just imported a shapefile on GRASS, and I need to convert several fields from CHAR to numeric (double precision) - at my own risk, of course.
Can I do it on grass, or I need to redo the thinks on arcgis ?!

Depends on your database backend. In PostgreSQL (and perhaps SQLite), you could do something like this:

echo “alter table XYZ alter column ABC type numeric” | db.execute

I don’t think anything like this would be possible in dbf…

You could also try a combination of v.db.addcol + v.db.update to create new numeric columns and set the value of these columns to the value of the varchar column.

Moritz