[GRASSLIST:1878] Re: s.in.shape error

Roger Bivand Roger.Bivand at nhh.no
Tue Nov 25 06:53:05 EST 2003

On Tue, 25 Nov 2003, David Kidd wrote:

> Dear Grasslist,
> I am very new to GRASS so this may be a known problem, however, I have had 
> no joy searching for a solution.
> I wish to use s.surf.rst to interpolate a surface from my point data set 
> but am having trouble importing my point data from ARCGIS. I have a 
> shapefile with z values (attached) created in ARC CATALOGUE that when I 
> import with  s.in.shape -z in=/home/dave/grassdata/lgmdtann.shp  says that 
> there is an error in site#39 and fails to load all 148 records.

I can confirm that there is a problem with lgmdtann.shp. I thought that it 
would be possible to read the shapefile into R, letting me see what is on 
site 39, using read.shape() in the maptools package, but the underlying 
shapelib code returns:

Error in read.shape("lgmdtann.shp") : Not a valid shape type

which means that it is none of types 1 - points, 3 - lines, or 5 - 
polygons. Further:

> getinfo.shape("lgmdtann.shp")
Info for lgmdtann.shp
Shapefile Type: PointZ(11)   # of Shapes: 148

File Bounds: (            -15,           -8.5)
        (         111.27,             69)

confirms that it is type 11. This is repeated by ogrinfo, which says:

$ ogrinfo lgmdtann.shp
INFO: Open of `lgmdtann.shp'
using driver `ESRI Shapefile' successful.
1: lgmdtann (3D Point)

In R the *.dbf was readable, but doesn't have an obvious z field:

> names(maptools:::dbf.read("lgmdtann.dbf"))
DBF field with "_" changed to Location.i
DBF field with "_" changed to Date.
[1] "Location.i" "LatDD"      "LongDD"     "Location"   "TannDelta" 
[6] "Date."      "DateStage"  "RefBrief"  

Do you need to save it as a 3D point shaefile? There are also a lot of 
missing values in the DBF file, but I don't know whether they are 
confusing things. All you seem to need transferred are LatDD, LongDD and 
TannDelta, so maybe just save those columns. If you use the R/GRASS 
interface, you can deal with your data in R first, then export it to the 
GRASS database for further analysis (details in Mitasova and Neteler: 
Open Source GIS).

Roger Bivand

> Any suggestions gratefully received
> Many thanks
> Dave Kidd
> ----------------------------------------------------------------------------------------------
> David M. Kidd
> Research Assistant
> School of Biology
> Room 210, Sir Harold Mitchell Building
> University of St. Andrews
> St. Andrews, Fife
> KY16 9TH
> UK
> http://www.st-and.ac.uk/~bugs/dave/dave.htm
> Tel:  +44 (0)1334 463348
> Fax: +44 (0)1334 463600
> ----------------------------------------------------------------------------------------------

Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no

More information about the grass-user mailing list