[R-sig-Geo] SpatialPointDataFrame to SpatialLinesDataFrame

Paulo Eduardo Cardoso paulo.mailing.list at gmail.com
Tue May 25 16:16:50 CEST 2010


Hi,

How can one coerce spatial point to spatial line?

I'm struggling to find a way of coerce a point SPDF object to Lines
based in a ID [TARGET_ID] field.

Any idea will be very welcome.

Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots
  ..@ data       :'data.frame': 28 obs. of  8 variables:
  .. ..$ ID        : int [1:28] 462964 462990 463015 463034 463052 463069
463083 463102 463122 463144 ...
  .. ..$ TIME_STAMP: POSIXlt[1:28], format: "2009-07-26 09:00:07"
"2009-07-26 09:00:13" "2009-07-26 09:00:19" "2009-07-26 09:00:25" ...
  .. ..$ DAY_PERIOD: int [1:28] 1 1 1 1 1 1 1 1 1 1 ...
  .. ..$ SEASON    : int [1:28] 2 2 2 2 2 2 2 2 2 2 ...
  .. ..$ TARGET_ID : int [1:28] 108426 108426 108426 108426 108426 108426
108426 108426 108426 108426 ...
  .. ..$ SPEED     : num [1:28] 0.283 0.6 0.4 0.2 0.2 ...
  .. ..$ HEADING   : int [1:28] 134 1 179 179 179 271 123 179 179 90 ...
  .. ..$ DISTANCE  : num [1:28] 1.41 3 2 1 1 ...
  ..@ coords.nrs : int [1:2] 7 6
  ..@ coords     : num [1:28, 1:2] -8.71 -8.71 -8.71 -8.71 -8.71 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:2] "LONGITUDE" "LATITUDE"
  ..@ bbox       : num [1:2, 1:2] -8.82 38.73 -8.69 38.8
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : chr [1:2] "LONGITUDE" "LATITUDE"
  .. .. ..$ : chr [1:2] "min" "max"
  ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
  .. .. ..@ projargs: chr " +init=epsg:4326 +proj=longlat +ellps=WGS84
+datum=WGS84 +no_defs +towgs84=0,0,0"


Paulo Eduardo Cardoso



More information about the R-sig-Geo mailing list