[R-sig-Geo] problems with plotting STFDF

Hodgess, Erin HodgessE at uhd.edu
Sun Dec 29 19:43:19 CET 2013


I had tried x <- as(x, "STIDF")
but it didn't like that.


Thanks!

Erin

________________________________________
From: r-sig-geo-bounces at r-project.org [r-sig-geo-bounces at r-project.org] on behalf of Tomislav Hengl [hengl at spatial-analyst.net]
Sent: Sunday, December 29, 2013 12:12 PM
To: r-sig-geo at r-project.org
Subject: Re: [R-sig-Geo] problems with plotting STFDF

Hi Erin,

In the spacetime package there should be a function that allows you to
coerce from STFDF to STIDF class e.g. "as.STIDF.STFDF"
(https://r-forge.r-project.org/scm/viewvc.php/pkg/R/coerce.R?view=markup&root=spacetime
<https://r-forge.r-project.org/scm/viewvc.php/pkg/R/coerce.R?view=markup&root=spacetime&pathrev=25>).
Once your object is of STIDF class, then you can use "kml" function e.g.
in a loop:

x <- as.STIDF.STFDF(x)
kml_open("x.kml")
kml_layer(x, colour="var1.pred")
kml_close("x.kml")

I might add plotting support for STFDF objects in the future. At the
moment I do not see a special reason for this because STFDF is basically
a 'compressed' / special case of STIDF, which hence needs to be
'decompressed' anyway before you can write it to KML (classes in the
spacetime package are hence more creative than in the KML, but then the
beauty of KML is that it is rather simple while the compression is
implemented usually through zipping / KMZ).

HTH

T. Hengl
https://www.vcard.wur.nl/Views/Profile/View.aspx?id=37263


On 29-12-2013 16:55, Edzer Pebesma wrote:
>
> On 12/28/2013 10:02 AM, Barry Rowlingson wrote:
>> On Sat, Dec 28, 2013 at 2:57 AM, Hodgess, Erin <HodgessE at uhd.edu> wrote:
>>> Hello everyone!
>>>
>>> Hope you're enjoying some holiday time!
>>>
>>> I'm running into a little snag here.  I'm working through the example on krigeST, which produces an STFDF object.  Fine so far.
>>>
>>> However, I would like to produce a Google Earth object from that.
>>>
>>> When I use plotKML, I get:
>>>
>>>> plotKML(DE_kriged,"var1.pred")
>>> Error in (function (classes, fdef, mtable)  :
>>>    unable to find an inherited method  for function ‘plotKML’ for signature ‘"STFDF"’
>>> Or when I use kml, I get:
>>>
>>>> kml(DE_kriged,"var1.pred")
>>> Error in (function (classes, fdef, mtable)  :
>>>    unable to find an inherited method for function ‘kml’ for signature ‘"STFDF"’
>>> What should I be doing, please?
>>   The functions are essentially saying "I don't know what to do with an
>> STFDF object". Is there any documentation that says these functions
>> can do something sensible with STFDF data? Maybe the code is yet to be
>> written...
>>
>> Barry
>>
> library(plotKML)
> showMethods("plotKML")
>
> and also ?plotKML confirm what Barry just suggested.
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list