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
readVECT6 temporary failure
7 messages · Roger Bivand, Facundo Muñoz
On Wed, 2 Apr 2008, Facundo Mu?oz wrote:
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.
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
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
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo
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
1 day later
Roger Bivand escribi?:
On Wed, 2 Apr 2008, Facundo Mu?oz wrote:
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.
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
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.-
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/
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20080404/79c82ab1/attachment.pl>
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. Roger
Greetings!
Facundo.-
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
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20080404/6dd518e0/attachment.pl>
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