[R-sig-Geo] Fwd: Re: plotKML with trajectories

Tomislav Hengl hengl at spatial-analyst.net
Fri Oct 5 14:43:04 CEST 2012



On 04/10/2012 23:37, Lay, Matthew (RTA) wrote:
> Hi,
>
> I'm using code from http://plotkml.r-forge.r-project.org/tutorial.php
> :
>
> library(fossil);library(adehabitat);library(ade4);library(plotKML)
> data(gpxbtour) gpxbtour$ctime <- as.POSIXct(gpxbtour$time,
> format="%Y-%m-%dT%H:%M:%SZ") coordinates(gpxbtour) <- ~lon+lat
> proj4string(gpxbtour) <- CRS("+proj=longlat +datum=WGS84") xy <-
> as.list(data.frame(t(coordinates(gpxbtour)))) gpxbtour$dist.km <-
> sapply(xy, function(x) { deg.dist(long1=x[1], lat1=x[2],
> long2=xy[[1]][1], lat2=xy[[1]][2]) } )> library(spacetime) gpx.ltraj
> <- as.ltraj(coordinates(gpxbtour), gpxbtour$ctime, id = "th") gpx.st
> <- as(gpx.ltraj, "STTDF") gpx.st$speed <- gpxbtour$speed
> gpx.st at sp@proj4string<mailto:gpx.st at sp@proj4string> <-
> CRS("+proj=longlat +datum=WGS84") plotKML(gpx.st,
> colour="speed",kmz=FALSE)
>
> Which runs, but produces a different image than the one on the web
> page.
>
> The key difference is that the web image has a playback widget and
> mine does not.
>
> The reason the difference matters to me is that I want to use the
> play back feature to show how the system evolves with time.
>
> My question is "how do I get the play back facility to appear?"

Good question. Open the KML folder in Google Earth and select the
trajectory/path object as active layer. This will open the playback
widget on the Google Earth screen.

Google Earth sometimes 'hides' it's functionality, but it is there  ;)

>
> Also, I would like to show only the latest point in charts like this,
> rather than have the tails showing all previous positions. This is
> because I am working towards showing multiple vehicles, with
> crisscrossing paths, and the tails turn into a web. The example on
> the web page above the one I have shown has a good example of where
> the whole history of a trajectory is shown, not just the most recent
> point.
>
> (beginner by the way!)
>
>
> This email is confidential and may also be privileged.  If you are
> not the intended recipient, please notify us immediately and delete
> this message from your system without first printing or copying it.
> Any personal data in this email (including any attachments) must be
> handled in accordance with the Rio Tinto Group Data Protection Policy
> and all applicable data protection laws.
>

Interesting signature. Delete from R-sig-geo?

T. Hengl
http://www.wewur.wur.nl/popups/vcard.aspx?id=HENGL001

>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________ 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