times and ID records for sp
On Wed, 19 Apr 2006, Michael Sumner wrote:
Hello, I'm trying to figure out the best way to represent time-ordered records in a SpatialPointsDataFrame.
Interesting question. I might have chosen rather to create a time_ordered_records object, use the standard SpatialPoints object, and go to a SpatialPointsTOR object, for which the standard SpatialPoints methods should still work. Then the extra logic for validation can be put in place without needing to fit the AttributeList object framework. Another possibility is to stack the IDs on the outside, in a new class of a set of SpatialPointsTOR objects, one object per unique trip, which would make it easier to retrieve by ID - SPDF are by design best at retrieving per location. Please tell us how you got on! Roger
In other contexts . . . I use a class "trip" which is simply a list of slots "x", "y", "time", "id" and until now I've simply handled it as a list internally and defined methods for as.list and as.data.frame - I'd like to write it as a SPDF. What I'd mostly like to do is a single vector of class POSIXct/lt with names. The names would act as a grouping factor for individual record sets within the time-ordered records, and so validity functions would ensure that the times were increasing within factors. Then I would have an extension to SPDF where one column was "timeID" and handle all the trip information that way. I've toyed with creating another slot (like coordinates) to hold a dataframe of timedates and IDs, but it's mostly too complicated for me since POSIXt is S3 - I just don't understand how to setOldClass -, and row names are (quite rightly) dropped in sp's AttributeList and so I'm kind of on the wrong track. Nothing like asking a question: as I write this I think perhaps it should be a new slot that is a matrix (just like coords), and I just store the times and IDs as integers with conversion methods when they are accessed . . . Then the new class is an extension of SPDF (or perhaps of SpatialPoints - the time/IDs don't need to be considered as "data" if the methods are all there). I'd always assumed I would use POSIXt, but that can be wrapped in the accessor methods I think. I'll try that out - thanks for listening, and I welcome any advice. I've toyed with some of the irregular time series in its and zoo, but they seem like overkill for my purposes. Cheers, Mike.
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo
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