[R-sig-Geo] readVECT6 temporary failure
Roger Bivand
Roger.Bivand at nhh.no
Fri Apr 4 13:07:46 CEST 2008
On Fri, 4 Apr 2008, Facundo Muñoz wrote:
> Roger Bivand escribió:
>> On Fri, 4 Apr 2008, Facundo Muñoz wrote:
>>
>> > I correct myself:
>> > when the directory is clean readVECT6 does the job, but leaving a .shp
>> > and a .dbf files, who are responsible of the failure in the next
>> > readVECT6.
>> > So the real question would be: why it does leave those trailing files?
>>
>> The function does try to unlink those files. Are there any spaces in the
>> names of the files and directories used, are there any non-ASCII
>> characters in the names? Could you please paste everything you see running
>> the first time into an email, and attach a screen shot of the terminal
>> window too - I guess that this is a path or file name question.
>
> Ok, here is a paste of the GRASS console window, with comments inserted:
>
> Welcome to GRASS 6.2.3 (2007)
> GRASS homepage: http://grass.itc.it/
> This version running thru: GNU Bash (Cygwin)
> (/usr/bin/bash.exe)
> [...]
> GRASS 6.2.3 (Valencia):~/scr > r --no-save
>
> R version 2.6.2 (2008-02-08)
> Copyright (C) 2008 The R Foundation for Statistical Computing
> [...]
>
>> library(spgrass6)
> library(spgrass6)
> Loading required package: sp
> Loading required package: rgdal
> Geospatial Data Abstraction Library extensions to R successfully loaded
> Loaded GDAL runtime: GDAL 1.5.0, released 2007/12/18
> GDAL_DATA: c:/Archiv~1/R/R-2.6.2/library/rgdal/gdal
> Loaded PROJ.4 runtime: Rel. 4.6.0, 21 Dec 2007
> PROJ_LIB: c:/Archiv~1/R/R-2.6.2/library/rgdal/proj
>
> Up here is the only path that contains spaces: "Archiv~1" is "Archivos de
> Programa" (Program Files) in the Windows directory structure.
>
>> medidas <- readVECT6("medidas")
> Exporting 52 points/lines...
> 100%
> 52 features written
> medidas <- readVECT6("medidas")
> OGR data source with driver: ESRI Shapefile
> Source: "C:\cygwin\home\usuario\grassdata\Valencia\geo_info\.tmp\facundo",
> layer: "medidas"
> with 52 rows and 11 columns
>
> First transfer completes successfully, but leaves the folowing files in the
> temporary directory
> C:\cygwin\home\usuario\grassdata\Valencia\geo_info\.tmp\facundo:
> 179.0 (O bytes), medidas.dbf, medidas.shp
> And, if I try to transfer something else...
It could be that the R unlink() is not removing the files, though it is
removing medidas.shx.
I'll look at this on my Cygwin system, and see if I can find a solution.
Is your Valencia location very large? Could you make a tarball available
to try with your data, if it is not too big?
Could you also paste the output of sessionInfo() into an email - perhaps R
in Windows and cygwin think that they are in different locales? Something
is affecting unlink() or list.files(), and the list of file names to
unlink is not being created correctly.
Roger
>
>> medidas2 <- readVECT6("medidas")
> ERROR 4: Unable to open
> /home/usuario/grassdata/Valencia/geo_info/.tmp/facundo/m
> edidas.shx or
> /home/usuario/grassdata/Valencia/geo_info/.tmp/facundo/medidas.SHX
> .
> ERROR 4: Failed to open shapefile
> /home/usuario/grassdata/Valencia/geo_info/.tmp
> /facundo/medidas.shp.
> It may be corrupt.
>
> Two notes about this error:
> - it is independent of what map I try to transfer. I used the same map for
> the example, but the same happens for any other map with any other name
> - it's the same error i get if i try to manually export from GRASS any map to
> that directory.
>
> ERROR:No se puede abrir el origen de datos OGR
> '/home/usuario/grassdata/Valencia/geo_info/.tmp/facundo'
> medidas2 <- readVECT6("medidas")
> Error en ogrInfo(dsn = dsn, layer = layer) :
> GDAL Error 4: Unable to open
> C:\cygwin\home\usuario\grassdata\Valencia\g
> eo_info\.tmp\facundo\medidas.shx or
> C:\cygwin\home\usuario\grassdata\Valencia\ge
> o_info\.tmp\facundo\medidas.SHX.
> Calls: readVECT6 -> readOGR -> ogrInfo -> .Call
> Ejecución interrumpida
> GRASS 6.2.3 (Valencia):~/scr >
>
> Greetings!
> Facundo.-
> ---
> Departament d'Estadística i Investigació Operativa
> Universitat de València (Estudi General)
> Facultat de Matemàtiques, Dr. Moliner 50, 46100 Burjassot, Spain.
> (+34) 96 354 3987, fax: (+34) 96 354 3238
> e-mail: Facundo.Munoz at uv.es, web: http://www.uv.es/~famarmu/
>
>
--
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
More information about the R-sig-Geo
mailing list