[R-sig-Geo] suggestion for spgrass6 - temp file in readVECT6

Pierre Roudier pierre.roudier at gmail.com
Tue Dec 14 22:50:40 CET 2010

Hi Roger,

Thanks for the patch. Unfortunately it does not work on my box, but I
suspect that to be related with my readVECT6() problem.

foo <- readVECT6('bar', driver='GML')
Error in ogrInfo(dsn = dsn, layer = layer, input_field_name_encoding =
input_field_name_encoding) :
  Cannot open layer

writeVECT6(foo, 'deletethis', driver='GML')
Available OGR Drivers:
Error in writeOGR(SDF, dsn = rtmpfl1, layer = shname, driver = driver) :

        GDAL Error 4: Failed to create GML file

So I guess I'd better fix that problem first>

Sorry I can't provide better testing for now,



2010/12/15 Roger Bivand <Roger.Bivand at nhh.no>:
> On Fri, 10 Dec 2010, Roger Bivand wrote:
>> On Thu, 9 Dec 2010, Dylan Beaudette wrote:
>>> On Thursday, December 09, 2010, Pierre Roudier wrote:
>>>> Dear all,
>>>> I got a suggestion for spgrass6. As far as I understand it, a
>>>> temporary ESRI shapefile is written on the disk when using
>>>> readVECT6('foo'), I guess then R is using rgdal to read that shapefile
>>>> back in memory. Considering the various limitations of the ESRI
>>>> shapefile format that does not occur with the GRASS internal format,
>>>> could it be possible to add an option to choose the OGR format used in
>>>> that process?
>>>> Also got a question for Roger I guess: I'm using now the grass7 svn
>>>> trunk, should I expect any problems using the spgrass6 interface (I
>>>> mean problems due to structural differences that appears in grass7
>>>> that would not be handled by spgrass6, not problems due to grass7
>>>> itself).
>>>> Thanks,
>>>> Pierre
>>> This is an excellent point Pierre, and something that has caused
>>> significant pain the past-- in terms of column names and NULL value
>>> handling. Not everyone's GDAL/OGR will be configured in the same way-- so I
>>> don't know if altering the default behavior would be wise. However, adding
>>> an option (as you suggested) to use some other format, such as SQLite, would
>>> give power users a nice alternative to SHP format. SQLite would allow for
>>> longer field names, proper support for NULL data, and probably some other
>>> 'good things'.
>> SQLite is an extra OGR driver that will be dependent on the OGR being used
>> on the platform in question. The OGR used by GRASS may be the same as that
>> used by rgdal, but may not be (R binary rgdal packages for Windows and OSX,
>> which have minimal driver sets).
>> I'll attempt to add a driver= argument to readVECT6() and writeVECT6(),
>> and drivername= readRAST6() and writeRAST6() for the temporary files.
> Could either of you, or others who may be interested, please try the draft
> version by anonymous checkout fot the spgrass6 module from the sourceforge
> r-spatial project, or using the source package at:
> http://spatial.nhh.no/R/Devel/spgrass6_0.6-24.tar.gz
> If you report back that it suits your needs, I'll submit it to CRAN; if you
> need further changes, please let me know.
> Roger
>> Typically, for reading native GRASS data, users build GRASS plugins for
>> OGR/GDAL. readVECT6() and readRAST6() both by default check for the presence
>> of the plugin, and use it if present, avoiding any intermediate files being
>> created.
>> The recently released revision of spgrass6 (0.6-23) does work with GRASS >
>> 6.3, including GRASS 7. This is signalled by the use of "GRASS 6+" rather
>> than just "GRASS 6" in its title and short description.
>> Hope this helps,
>> Roger
>>> Dylan
> --
> Roger Bivand
> Economic Geography Section, Department of Economics, Norwegian School of
> Economics and Business Administration, Helleveien 30, N-5045 Bergen,
> Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
> e-mail: Roger.Bivand at nhh.no
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

More information about the R-sig-Geo mailing list