Blue marble and Landsat in R 2.

I have just been asked if the images in the previous post could be produced simply in two dimensions so that points could be easily over plotted. The code to do this can be taken strait from the rimage package and very slightly adapted for a “SpatialGridDataFrame”. I haven’t worked out how it could be done using lattice.


colvec <- rgb(d[[red]],d[[green]],d[[blue]],m=255)
colors <- unique(colvec)
d[[“colmat”]] <- match(colvec, colors)




One thought on “Blue marble and Landsat in R 2.

  1. Roger Bivand has just sent me an alternative, rather more elegant way of achieving the result in this post. One of the great things about R is the constant discovery of features that you hadn’t used before and the generosity of those responsible for their development.

    x <- d[c(1,3,2)]
    xc <- SGDF2PCT(x)
    x$idx <- xc$idx
    image(x, “idx”, col=xc$ct)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s