[GRASS-stats] Towards spgrass7

Markus Neteler neteler at osgeo.org
Wed Jan 21 06:08:16 PST 2015


Hi,

we came across another issue:

When importing a vector map but with "type" being defined (either
wrong type or by being selective in a multi-type vector map), then the
internal SHAPE files are not properly cleaned up and block further
import:

> myspear <- readVECT("roads", with_c=TRUE, type="point")
WARNING: 825 line(s) found, but not requested to be exported. Verify 'type'
         parameter.
WARNING: No points found, but requested to be exported. Will skip this
         feature type.
Exporting 0 features...
 100%
WARNING: Output layer is empty, no features written
v.out.ogr complete. 0 features (Point type) written to <roads>
(ESRI_Shapefile format).
Error in rgdal::readOGR(dsn = rtmpfl1, layer = shname, verbose =
!ignore.stderr) :
  no features found
In addition: Warning messages:
1: In execGRASS("v.out.ogr", flags = flags, input = vname, type = type,  :
  The command:
v.out.ogr -e -c input=roads type=point layer=1
output=/home/neteler/grassdata/spearfish60_grass7/user1/.tmp/pgis_north
output_layer=roads format=ESRI_Shapefile
produced at least one warning during execution:
WARNING: 825 line(s) found, but not requested to be exported. Verify 'type'
         parameter.
WARNING: No points found, but requested to be exported. Will skip this
         feature type.
Exporting 0 features...
 100%
WARNING: Output layer is empty, no features written
v.out.ogr complete. 0 features (Point type) written to <roads>
(ESRI_Shapefile format).
2: In ogrFIDs(dsn = dsn, layer = layer) : no features found

--> this error is ok but now the problem occurs while rerunning the command:

> myspear <- readVECT("roads", with_c=TRUE)
Error in execGRASS("v.out.ogr", flags = flags, input = vname, type = type,  :
  The command:
v.out.ogr -e -c input=roads type=line layer=1
output=/home/neteler/grassdata/spearfish60_grass7/user1/.tmp/pgis_north
output_layer=roads format=ESRI_Shapefile
produced an error (1) during execution:
ERROR: Layer <roads> already exists in OGR data source
       '/home/neteler/grassdata/spearfish60_grass7/user1/.tmp/pgis_north'
>

The reason is here ("garbage" left):

GRASS 7.0.0svn (spearfish60_grass7):~/software/spgrass > ls -la
/home/neteler/grassdata/spearfish60_grass7/user1/.tmp/pgis_north
total 24
drwxr-xr-x. 2 neteler gis 4096 Jan 21 15:03 ./
drwxr-xr-x. 3 neteler gis 4096 May 30  2014 ../
-rw-r--r--. 1 neteler gis   97 Jan 21 15:03 roads.dbf
-rw-r--r--. 1 neteler gis  414 Jan 21 15:03 roads.prj
-rw-r--r--. 1 neteler gis  100 Jan 21 15:03 roads.shp
-rw-r--r--. 1 neteler gis  100 Jan 21 15:03 roads.shx

It appears that these files are not cleaned up after readVECT()
execution in case of using the "type" parameter.
I am not sure where to fix that in the spgrass code.

thanks
Markus


More information about the grass-stats mailing list