3d-Shapefile in R
On Fri, 13 Nov 2009, Siber Rosi wrote:
Dear list, I would like to have the z-values of a river shapefile in R (sp). So that I have at the end a list of x,y and z-coordinates, for which I do further analysis.
Is there a way of importing a 3d-shapefile direct in R?
Yes, but only for points. The objects used to represent lines and polygons are 2D. To move forward, a Line3D representation with downstream Lines3D and SpatialLines3D classes would be needed. However, analysis on 3D lines may be hard to do - so something more like GPX track_points might be more useful, or the representation of sequences of points from the trip or adehabitat (ltraj class) packages. Just being able to read the data is only the first step, finding an adequate representation with convenient analysis tools is probably harder. Using the Z dimension in shapefiles is arguably not a portable way of representing this, using points with a constant lineID and sequence numbers increasing downstream, with elevation at the points, may be easier to handle. (Untried) Convert to say GPX and read as track_points, trying to retain the necessary attributes. Hope this helps, Roger
When I was using the readOGR command, the following message appear.
****************
riv_CH <- readOGR(".", "riverz")
OGR data source with driver: ESRI Shapefile
Source: ".", layer: "riverz"
with 13 features and 13 fields
Feature type: wkbLineString with 3 dimensions
Warnmeldung:
In readOGR(".", "riverz") : Z-dimension discarded
*****************
Do you have any suggestion for handling the z-dimension?
Thanks a lot in advance, Rosi
???
Rosi Siber
Swiss Federal Institute of Aquatic Science and Technology (Eawag)
Siam
Ueberlandstrasse 133
8600 Duebendorf
Switzerland
Phone: +41 (0)44 823 5566
Fax: +41 (0)44 823 5375
rosi.siber at eawag.ch
http://www.eawag.ch/~siberros
[[alternative HTML version deleted]]
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