Skip to content

readVECT6 temporary failure

7 messages · Roger Bivand, Facundo Muñoz

#
Hello list,

i've been dealing all day with this, and i can't find the problem.
It suddenly begun to happen.

Im working with GRASS 6.2.3 under CygWin, and with R 6.2.2 with the 
latest libraries (in fact, while trying to solve this problem, i removed 
all R versions, and reinstalled the latest. But is still failing).

This is it:
i start GRASS, and open the location i'm working with.
then i start R from GRASS console, load spgrass6 library, and i transfer 
a vector map:

	GRASS> r --no-save
	R> library(spgrass6)
	R> medidas <- readVECT6("medidas")

everything goes fine so far.
but if i try to transfer some other vector map, it fails. In fact, if i 
just try to export a vector map to the temporary directory used by 
readVECT then:

	v.out.ogr input=ejes_1 type=line,boundary 
dsn=/home/usuario/grassdata/Valencia/geo_info/.tmp/facundo olayer=mmtest 
layer=1 format=ESRI_Shapefile

	ERROR 4: Unable to open 
/home/usuario/grassdata/Valencia/geo_info/.tmp/facundo/medidas.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.


	No se puede abrir el origen de datos OGR 
'/home/usuario/grassdata/Valencia/geo_info/.tmp/facundo'



Note that while i tried to write a file called mmtest, the error talks 
about de previously wwritten file: medidas
Besides, i can write fine to any other directory.

So i go see what's going on in there, and i verify that after the first 
transfer is done there remains those files medidas.dbf and medidas.shp, 
which are responsible of the failure, since if i remove them manually, 
the failure stops.

the problem arises only after de use of readVECT6. If i try to export a 
map to that directory it doesn't "hang" the directory.

it looks as if the use of readVECT6 blocked the directory.


Thank you in advance.
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
#
On Wed, 2 Apr 2008, Facundo Mu?oz wrote:

            
Is there a stray *.dbf file in the temporary directory? OGR with the ESRI 
Shapefile driver does not like extra *.dbf or other irregularities.

In situations like this, just side-step readVECT6, use 
system("r.out.ogr ...") to an arbitrary directory, and readOGR() from 
there. There are multiple components operating, so complete control is not 
possible, but I have seen problems with stray *.dbf files before that were 
hard to debug.

Roger

  
    
1 day later
#
Roger Bivand escribi?:
No, i made sure to clean things: I even erased de whole directory and 
let GRASS create it again when he needed it.
Any way, the alternate way is easy and works well.
(A curiosity: writeVECT6 keeps working fine)

Thank you very much.
       Facundo.-
#
On Fri, 4 Apr 2008, Facundo Mu?oz wrote:

            
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.

Roger

  
    
#
On Fri, 4 Apr 2008, Facundo Mu?oz wrote:

            
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