[R-sig-Geo] Anyone attempted to "animate" multi-layered rasters?

Yihui Xie xie at yihui.name
Mon Nov 29 22:36:13 CET 2010


I have solved the second problem a couple of weeks ago but did not
release it to CRAN; recently I'm in the process of moving my
repository to GitHub: https://github.com/yihui/animation I have
finished it yesterday. If the namespace conflict is a serious problem,
I can push a new version to CRAN soon.

For the first problem, I am not aware of the potential problems, but I
will try to remove these setwd() calls in the next version. I do not
even remember why I needed to change working directories frequently 3
years ago when I wrote these functions... I guess I forgot to add
these comments to my code then:

## When I wrote this, only God and I understood what I was doing
## Now, God only knows

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA



On Mon, Nov 29, 2010 at 3:06 PM, steven mosher <moshersteven at gmail.com> wrote:
> I think GraphicsMagick is superior.  I have not programmed C since maybe
> 1993, so I am read capable and write limited. I've got the source. It does
> not look easy.
> For sci-vis ( scientific visualization) I am wondering what the best format
> will be for animation.
>
> A couple other notes. It would be nice if animation were modified  a bit.
> 1. To rewrite the functions so that the api does not change directories when
> doing the
>      image writing. As it stands now the code changes directories to the
> IMAGE directory
>      writes images and then changes back ( If I am recalling) This led to
> some problems
>      with raster. I think Robert Hijmans fixed that problem on the raster
> side, but I would
>      suggest changing it on the animation side as well.
>  2. package dependencies. The package loads the MASS package which has a
> namespace
>     fight with api in raster  ( area). while this is easily fixed, it did
> cost me a couple days to figure out.   In short, your example code requires
> certain packages to be loaded, but for those
>     folks who just want to use ani.options, ani.start() and ani.stop(), the
> packages are not required.
>  I just solved those two problems by hacking up the nice package, and really
> tuning it to my purpose.  in my perfect world  it would work like this and
> just be a method one uses on a
> raster "brick" object.
> animate(brick, imageDirectory="tbd", type=c("html","mov" etc....),...)
>
> conceptually..
>
>
>
> On Mon, Nov 29, 2010 at 12:43 PM, Yihui Xie <xie at yihui.name> wrote:
>>
>> Porting ImageMagick or GraphicsMagick into R is not a trivial task,
>> and my knowledge on C is rather limited. I will be very happy if
>> anyone can do this.
>>
>> And thanks Steven for letting me know GraphicsMagick. It looks like a
>> better choice.
>>
>> Regards,
>> Yihui
>> --
>> Yihui Xie <xieyihui at gmail.com>
>> Phone: 515-294-2465 Web: http://yihui.name
>> Department of Statistics, Iowa State University
>> 2215 Snedecor Hall, Ames, IA
>>
>>
>> On Mon, Nov 15, 2010 at 4:49 PM, Jacob van Etten
>> <jacobvanetten at yahoo.com> wrote:
>> >
>> > I got ImageMagick working on Windows. The only problem occurred when I
>> > tried to write the movie file to a directory with subdirectories in it. It
>> > works with an empty directory, though.
>> >
>> > I think it should be possible to incorporate the code from ImageMagick
>> > or GraphicsMagic into an R package, making an external install unnecessary.
>> >
>> > Jacob.
>> >
>> > --- On Mon, 15/11/10, Kevin Ummel <kevinummel at gmail.com> wrote:
>> >
>> > From: Kevin Ummel <kevinummel at gmail.com>
>> > Subject: Re: [R-sig-Geo] Anyone attempted to "animate" multi-layered
>> > rasters?
>> > To: "steven mosher" <moshersteven at gmail.com>
>> > Cc: "Jacob van Etten" <jacobvanetten at yahoo.com>,
>> > R-sig-Geo at stat.math.ethz.ch, xie at yihui.name
>> > Date: Monday, 15 November, 2010, 23:26
>> >
>> > Thanks, Jacob.
>> > For the community: I've successfully installed ImageMagick on Mac OS
>> > 10.6.4 (i.e. the sample commands to verify functionality check
>> > OK: http://www.imagemagick.org/script/binary-releases.php?ImageMagick=cmdb7qc5snnquootuef90ki645#macosx).
>> > I receive an error running Jacob's example code:
>> > Error in cmd.fun(sprintf("%s --version", convert), intern = TRUE) :
>> >   error in running command
>> > sh: convert: command not found
>> > I don't believe this is an 'animate' issue, but is a thorny path problem
>> > that apparently plagues ImageMagick installs via MacPorts. I tried some
>> > things based on the message boards at ImageMagick without success. This
>> > isn't the place for ImageMagick troubleshooting, but a heads up for Mac
>> > users trying to implement Jacob's example...
>> > Thanks,
>> > Kevin
>> > On Nov 15, 2010, at 9:35 PM, steven mosher wrote:
>> >
>> > Thanks Jacob,
>> >
>> >  I was unable to get ImageMagick working ( which saveMovie() relies
>> > upon.. as I recall ) so I had to live with the html animation.
>> >
>> >
>> >
>> > On Mon, Nov 15, 2010 at 12:58 PM, Jacob van Etten
>> > <jacobvanetten at yahoo.com> wrote:
>> >
>> > A function is not really necessary. It´s actually quite simple.
>> >
>> > library(raster)
>> > library(animation)
>> > setwd("c:/empty")
>> >
>> > logo <- raster(system.file("external/rlogo.grd", package="raster"),
>> > values=TRUE)
>> >
>> > saveMovie(
>> > for(i in 1:250)
>> > {
>> >     logo1 <- logo
>> >     logo1[logo1<i] <- 0
>> >     #here you could also extract a RasterLayer from a RasterStack
>> >     plot(logo1, main=i)
>> > },
>> > loop=1,
>> > interval= 0.1,
>> > outdir = getwd(),
>> > moviename="logo")
>> >
>> > Cheers,
>> >
>> > Jacob.
>> >
>> > --- On Sat, 13/11/10, Kevin Ummel <kevinummel at gmail.com> wrote:
>> >
>> > From: Kevin Ummel <kevinummel at gmail.com>
>> > Subject: [R-sig-Geo] Anyone attempted to "animate" multi-layered
>> > rasters?
>> > To: R-sig-Geo at stat.math.ethz.ch
>> > Date: Saturday, 13 November, 2010, 12:58
>> >
>> > Hello,
>> >
>> > I came across the 'animate' package, and I'm wondering if anyone has
>> > successfully adapted it to create animations of multi-layered spatial data.
>> >
>> > This seems like a logical advance of R's spatial data visualization,
>> > especially given the prominence of NetCDF and HDR file types, but I don't
>> > want to replicate if someone else already has a function in working order...
>> >
>> > Cheers,
>> > Kevin
>> >
>> > Kevin Ummel
>> > Senior Visiting Associate, Center for Global Development
>> > MESPOM Candidate, University of Manchester
>> >
>> > _______________________________________________
>> > R-sig-Geo mailing list
>> > R-sig-Geo at stat.math.ethz.ch
>> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> >
>> >
>> >
>> >
>> >        [[alternative HTML version deleted]]
>> >
>> >
>> > _______________________________________________
>> > R-sig-Geo mailing list
>> > R-sig-Geo at stat.math.ethz.ch
>> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> >
>> >
>> >
>> >
>
>



More information about the R-sig-Geo mailing list