[GRASS-stats] readVECT6 - ogr fails to export some columns

Eric Momsen eric.momsen at ndsu.edu
Fri Apr 20 10:47:42 EDT 2012


Hi,

I've been using GRASS and R for a few months now, and just ran into a snag.
 We added some new attribute columns to our vector file in GRASS, and now
when I try to move the data into R the transfer fails.

The original vector map in grass was imported from a shapefile.  I then
used v.db.addcol and v.rast.stats to add more attributes to the vector map.

I first thought it had to do with null values, so I tried adding a column
filled with a constant value.  This didn't help.

I tried to reproduce the error in SPEARFISH, columns added with
v.rast.stats were fine, but v.db.addcol wouldn't execute.


I don't know why the installation let me add columns in one location and
not another, maybe this is the root cause or another issue all together?

v.db.addcolumn --verbose map=landuse at PERMANENT layer=1 columns=test

Adding column <test> to the table
DBMI-DBF driver error:
SQL parser error (syntax error, unexpected $end processing
'') in statement:
ALTER TABLE landuse ADD COLUMN test
Unable to execute statement.
ERROR: Error while executing: 'ALTER TABLE landuse ADD COLUMN test'
ERROR: Unable to add column <test>.


Any ideas for what I'm missing, or a workaround to get the data to R?  (I
was supposed to get an R data file ready today for others to work with that
aren't used to GRASS...I had previously done the GRASS->R transfer via a
script a number of times, and didn't expect any problems!)

Here are the R messages:

> source("/home/emomsen/Documents/loaddata.R")

first command in file:
field2007<-readVECT6("ACSC_2007_Field_Boundary")

Loading required package: rgdal
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.9.0, released 2011/12/29
Path to GDAL shared files: /usr/local/share/gdal
Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
Path to PROJ.4 shared files: (autodetected)
Available OGR Drivers:
Warning 1: Field COUNTY of width 1000 truncated to 255.
....snip... these are OK
ERROR 6: Failed to add field named 'HARVEST_DAY'
ERROR 6: Failed to add field named 'NDVI_04_B_DAY'
....snip...These were added with v.db.addcol
ERROR 6: Failed to add field named 'NDVI_04_B_mean'
...snip,... there are about 100 of these, extended statistics for 10
rasters.


The import does finish, all of the "original" columns for the shapefile are
imported to R.  v.db.select shows most of the attribute columns together
(the last ones are lost from the line length), and querying the map gives
all the attributes.

Thanks for any help!

Eric

> sessionInfo()
R version 2.14.1 (2011-12-22)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=C                 LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] rgdal_0.7-8     spgrass6_0.7-10 XML_3.9-4       sp_0.9-98

loaded via a namespace (and not attached):
[1] grid_2.14.1    lattice_0.20-0


g.gisenv -n

LANG=en_US.UTF-8
GRASS_ADDON_PATH=/home/emomsen/v.krige
GISDBASE=/home/shared/research/GRASSDATA
LOCATION_NAME=transferField
ADDON_PATH=/home/emomsen/v.krige
GUI=wxpython
MAPSET=PERMANENT
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-stats/attachments/20120420/a5016f08/attachment.html


More information about the grass-stats mailing list