[R-sig-Geo] How do I read/work with PolyLineZM with maptools/sp?

Mikhail Titov mlt at gmx.us
Mon May 16 20:51:31 CEST 2011


Edzer:

Thank you for your suggestions, but it doesn't help much. It does not recover either Z or M as attributes or anyhow else.

> p <- as(s, "SpatialPointsDataFrame")
> names(p)
[1] "Id"       "Lines.NR" "Lines.ID" "Line.NR" 
> slotNames(p)
[1] "data"        "coords.nrs"  "coords"      "bbox"        "proj4string"
> head(p at coords)
     coords.x1 coords.x2
[1,]  408794.5   4893921
[2,]  409088.3   4893599
[3,]  409165.2   4893484
[4,]  409434.7   4893214
[5,]  409684.9   4893060
[6,]  409742.6   4893060
> head(p at data)
    Id Lines.NR Lines.ID Line.NR
0    1        1        0       1
0.1  1        1        0       1
0.2  1        1        0       1
0.3  1        1        0       1
0.4  1        1        0       1
0.5  1        1        0       1 
> p$Z
NULL
> p$z
NULL

I double checked that I'm working with correct shapefile that has Z values.

Mikhail


> -----Original Message-----
> From: Edzer Pebesma [mailto:edzer.pebesma at uni-muenster.de]
> Sent: Monday, May 16, 2011 1:29 PM
> To: Mikhail Titov
> Cc: r-sig-geo at r-project.org
> Subject: Re: [R-sig-Geo] How do I read/work with PolyLineZM with
> maptools/sp?
> 
> 
> 
> On 05/16/2011 08:22 PM, Mikhail Titov wrote:
> >> I would try s$M and s$Z to access M and Z when they are attributes.
> > But what do I do when they are not? It can work for points, but not a
> line as I can't have attributes for individual points of a line. I would
> prefer not to do any extra conversions in GIS before using R.
> >
> 
> as(s, "SpatialPointsDataFrame")
> 
> > Do I get it right that for now it is better to stick with shapefiles to
> read PolylineZM?
> >
> > Mikhail
> >
> >
> 
> --
> Edzer Pebesma
> Institute for Geoinformatics (ifgi), University of Münster
> Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
> 8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
> http://www.52north.org/geostatistics      e.pebesma at wwu.de



More information about the R-sig-Geo mailing list