[GRASS-user] v.to.db fails

Rich Shepard rshepard at appl-ecosys.com
Fri Aug 10 11:04:02 PDT 2018


   The precipitation file in my earlier thread replaced the lon/lat
coordinates with the projected coordinates after running v.to.db on the
table. Replacing the source table with one having two more columns (date and
precipitation amount) is failing the coordinate conversion somewhere, and I
fail to spot where.

   Source file fragment:

name,lon,lat,elev,date,prcp
Headworks Portland Water,-122.1547,45.4486,228.0,2005-01-01,0.59
Headworks Portland Water,-122.1547,45.4486,228.0,2005-01-02,0.08
Headworks Portland Water,-122.1547,45.4486,228.0,2005-01-03,0.10
Headworks Portland Water,-122.1547,45.4486,228.0,2005-01-04,0.00
Headworks Portland Water,-122.1547,45.4486,228.0,2005-01-05,0.00
Headworks Portland Water,-122.1547,45.4486,228.0,2005-01-06,0.02
Headworks Portland Water,-122.1547,45.4486,228.0,2005-01-07,0.05
Headworks Portland Water,-122.1547,45.4486,228.0,2005-01-08,0.10
Headworks Portland Water,-122.1547,45.4486,228.0,2005-01-09,0.00
Headworks Portland Water,-122.1547,45.4486,228.0,2005-01-10,0.02

   Import command:

v.in.ascii in=$HOME/projects/data/precipitation/precip.csv skip=1 out=precip
sep=comma columns='name varchar, lon double precision, lat double precision,
elev double precision, date varchar, prcp double precision' x=2 y=3 z=4 --o

   Convert attribute table lon/lat to EPSG 2838:
v.to.db map=precip opt=coor col=lon,lat --o

   Export re-projected precipitation data for use in R:
db.out.ogr in=precip out=rainfall for=CSV --o

   Output file fragment:

cat,name,lon,lat,elev,date,prcp
"1",Headworks Portland Water,-122.1547,45.4486,228,2005-01-01,0.59
"2",Headworks Portland Water,-122.1547,45.4486,228,2005-01-02,0.08
"3",Headworks Portland Water,-122.1547,45.4486,228,2005-01-03,0.1
"4",Headworks Portland Water,-122.1547,45.4486,228,2005-01-04,0
"5",Headworks Portland Water,-122.1547,45.4486,228,2005-01-05,0
"6",Headworks Portland Water,-122.1547,45.4486,228,2005-01-06,0.02
"7",Headworks Portland Water,-122.1547,45.4486,228,2005-01-07,0.05
"8",Headworks Portland Water,-122.1547,45.4486,228,2005-01-08,0.1
"9",Headworks Portland Water,-122.1547,45.4486,228,2005-01-09,0
"10",Headworks Portland Water,-122.1547,45.4486,228,2005-01-10,0.02

   Where have I gone off the tracks here? It worked before.

Rich



More information about the grass-user mailing list