[GRASS-stats] rgrass7: readVECT() issue with drivers other than ESRI Shapefile

Markus Neteler neteler at osgeo.org
Wed Jun 17 05:36:45 PDT 2015


Dear Roger,

On Wed, Jun 17, 2015 at 12:41 PM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
> Hi,
>
> This has been lagging and needs attention - please provide a reproducible
> example. A work-around may also be to copy across the column names, but
> driver= is never regularly tested, and probably should be. rgrass7 uses:
>
> nc_basic_spm_grass7

Here an example for that location

g.copy vector=geonames,mygeonames
v.db.renamecolumn mygeonames column=ALTERNATEN,ALTERNATE_NAME

GRASS 7.0.1RC1 (nc_basic_spm_grass7):~ > R
# R version 3.2.0 (2015-04-16) -- "Full of Ingredients"

> library(rgrass7)
> geonames <- readVECT("mygeonames")
Warning 1: Field NAME of width 1000 truncated to 254.
Warning 1: Field ASCIINAME of width 1000 truncated to 254.
Warning 1: Field FEATURECLA of width 1000 truncated to 254.
Warning 1: Field FEATURECOD of width 1000 truncated to 254.
Warning 1: Field COUNTRYCOD of width 1000 truncated to 254.
Warning 1: Field CC2 of width 1000 truncated to 254.
Warning 1: Field ADMIN1 of width 1000 truncated to 254.
Warning 1: Field TIMEZONE of width 1000 truncated to 254.
Warning 1: Field MODIFICATI of width 1000 truncated to 254.
ERROR 6: Failed to add field named 'ALTERNATE_NAME'
Exporting 1088 features...
 100%
v.out.ogr complete. 1088 features (Point type) written to <mygeonam>
(ESRI_Shapefile format).
OGR data source with driver: ESRI Shapefile
Source: "/home/neteler/grassdata/nc_basic_spm_grass7/user1/.tmp/pgis_north",
layer: "mygeonam"
with 1088 features
It has 17 fields

--> to avoid unneeded trunkation, I would switch to GeoJSON as driver:

> geonames <- readVECT("mygeonames", driver="GeoJSON")
Error in .read_vect_non_plugin(vname = vname, layer = layer, type = type,  :
  Requested driver GeoJSON not supported

--> given that it is not yet added to the available driver list, I try GML:

> geonames <- readVECT("mygeonames", driver="GML")
Error in paste(gtmpfl1, shname, sep = .Platform$file.sep) :
  object 'shname' not found

If it matters:
> .Platform$file.sep
[1] "/"

I am on Fedora 21:
uname -a
Linux pgis_north 4.0.4-202.fc21.x86_64 #1 SMP Wed May 27 22:28:42 UTC
2015 x86_64 x86_64 x86_64 GNU/Linux

thanks,
Markus


More information about the grass-stats mailing list