Waseem Ali | 24 Nov 13:56 2015

How to download individual layer from MODIS Package using runGdal‏

Hi,I am recently working on downloading modis product called "MOD13Q1" EVI scientific data set starting
from 2001 to 2004 time series data. Downloading individual data from lpdaac is daunting task. With a
little effort I came across using MODIS R package to download bunch of data in a sequential fashion. The
following is my code for single scene:library(MODIS)dates <- as.POSIXct(
as.Date(c("01/05/2014"),format = "%d/%m/%Y") )
dates2 <- transDate(dates[1]) # Transform input dates from before 
h = "23"v = "05"runGdal(product = "MOD13Q1", begin=dates2$beginDOY,end = dates2$endDOY,tileH =
h,tileV = v)My question is that Is that possible i can add layer information despite to fully download hdf
(including 12 layers). I just need 2 layers that will reduce my time to download full product.Waseem Ali 

	[[alternative HTML version deleted]]
Egge-Jan Pollé | 23 Nov 16:13 2015

Open source e-book "Geografische analyses met R"

Hi list,

I would like to draw your attention to a new publication:

an open source e-book "Geografische analyses met R"



65 pages, packed with code samples, with sample data about the Netherlands.

Reviews are more than welcome.

Due to the language used in the book: this manual is mainly targeted at a
Dutch-reading audience.



Egge-Jan Pollé
e.j.h.polle <at> gmail.com

	[[alternative HTML version deleted]]
(Continue reading)

Agustin Lobo | 21 Nov 12:28 2015

Results from spdep::moran.mc() different from raster::Moran() on randomized raster layers

I compare results of moran.test() and moran.mc()
to results of randomizing a raster layer and
calculating the mean and range of the raster::Moran() values
using w=matrix(c(1,1,1,1,0,1,1,1,1), 3, 3) (following advise

While the spdep functions let reject the null hypothesis
of CSR because of regularity (which makes sense
because the test is a check board pattern),
the range of raster::Moran() for the randomized raster
layers include the actual value of the observed test layer.
Could this be caused by the fact that the test raster layer
is too small (8x8)? Because sample() is actually not
randomizing as boot()? An error on my side?

This is what I do:

Using the testGrid example provided by

lng <- rep(seq(0, 7, by=1), 8)
counter = 1
subCounter = 0
startNum = 0
lat = NULL
while (counter < 65) {
 if (subCounter == 8) {
   startNum = startNum + 1
   subCounter = 0
(Continue reading)

Agustin Lobo | 20 Nov 14:37 2015

Different values from raster::Moran() and spdep::moran.test()

Using the testGrid example provided by

lng <- rep(seq(0, 7, by=1), 8)
counter = 1
subCounter = 0
startNum = 0
lat = NULL
while (counter < 65) {
  if (subCounter == 8) {
    startNum = startNum + 1
    subCounter = 0
  lat = c(lat, startNum)
  subCounter = subCounter + 1
  counter = counter + 1
# now add the black/ white chessboard pattern
chess <- rep(c(0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0), 4)
gridNum <- seq(1:64)
testGrid <- data.frame(gridNum, lat, lng, chess)

I define
rtestGrid <- rasterFromXYZ(testGrid[,2:4])

and run

(Continue reading)

Agustin Lobo | 20 Nov 10:34 2015

title in plot of raster::stack or brick objects

r <- raster(nrows=10, ncols=10)
r <- setValues(r, 1:ncell(r))
s <- stack(r, sqrt(r), r/sqrt(r))
names(s) <- paste0("S",1:3)

Is there any way to put a main title centered on the multiple plot and
get the names of the layers displayed as well?

plot(s, main="S")
puts the title for the 1st layer only and eliminates the names of the
layers from the plot

Frede Aakmann Tøgersen | 20 Nov 07:35 2015

Re: How to get the borders of scattered spacial points

Hi Jay

So you have forgot all the information you got when you subscribed to the list?

To refresh your memory please see:


Yours sincerely / Med venlig hilsen

Frede Aakmann Tøgersen
Specialist, M.Sc., Ph.D.
Plant Performance & Modeling

Technology & Service Solutions
T +45 9730 5135
M +45 2547 6050
frtog <at> vestas.com

Company reg. name: Vestas Wind Systems A/S
This e-mail is subject to our e-mail disclaimer statement.
Please refer to www.vestas.com/legal/notice
If you have received this e-mail in error please contact the sender. 

-----Original Message-----
From: R-sig-Geo [mailto:r-sig-geo-bounces <at> r-project.org] On Behalf Of Jay Verstreater
Sent: 19. november 2015 19:57
To: r-sig-geo
Subject: Re: [R-sig-Geo] How to get the borders of scattered spacial points
(Continue reading)

Loïc Dutrieux | 19 Nov 14:37 2015

Match polygon and dataframe IDs after raster::extract

Hi all,

I'm trying to look at correlation between two raster layers, for 
different polygons. So I use raster::extract to get all the raster 
values for every polygon, do the calculation and feed the output back to 
a SpatialPolygonDataFrame.
I got it working, but I have a doubt regarding the order of the rows; 
and it doesn't look like I can use match.ID = TRUE.

See the example below.


# Create brick with 2 layers
b <- brick(ncol=36, nrow=18, nl=2)
b[[1]] <- rnorm(ncell(b))
b[[2]] <- rnorm(ncell(b))

# Create sp
cds1 <- rbind(c(-180,-20), c(-160,5), c(-60, 0), c(-160,-60), c(-180,-20))
cds2 <- rbind(c(80,0), c(100,60), c(120,0), c(120,-55), c(80,0))
cds3 <- rbind(c(-10,20), c(50,60), c(70,-10))
polys <- spPolygons(cds1, cds2, cds3)

# Extract all values
df0 <- extract(b, polys, df = TRUE)

# Compute correlation betwen the two layers for every polygons (sorry 
for the pipe)
(Continue reading)

Zhong-Yuan Zhang | 18 Nov 23:56 2015

How to get the borders of scattered spacial points

Dear All:

   As a freshman, I am now analyzing some spacial data.

I want to get the border of scattered spacial points. Are there

any libraries that I can use?  Also is there any library that can

use Baidu map API?  I highly appreciate your help and


   Best Regards Always.


Zhong-Yuan Zhang (PhD.)
Full Professor
School of Statistics
Central University of Finance and Economics
39 South College Road, Haidian District, Beijing, P.R.China 100081
Email: zhyuanzh <at> gmail.com
Homepage: *http://zhongyuanzhang.github.io/

	[[alternative HTML version deleted]]
Lutfor Rahman | 18 Nov 23:17 2015

probability contour plot on raster file

Dear forum member,

I have spatial cell/pixels (20 thousands cells) with their co-ordinates
with their corresponding values. I would like to crate probability contours
at 50%, 75% and 99% of those values and after that I would like overlay in
world map.

I should creat raster file and adding contours onto raster and bringing map
onto it (Please let me know-am I right? or there is other way of doing
this?). However, I count see any contours created on my raster while I am
using following code.

Can anyone let me know how I can create probability contours at three
different levels (in three colours; 50%, 75% and 99%). Please let me know
how I could transfer this raster with contours in a map like google terrain
map (any particular package).

Any suggestions will be much appreciated.

best regards



Population<-read.csv("rasterfile.csv", header=T)


(Continue reading)

André Bertoncini | 18 Nov 16:35 2015

Flow Accumulation Algorithm

Hi everyone,

Does anyone knows where I can find a code in R for the computation of flow
accumulation from a DEM?

I'm having a problem because the raster package does not perform this task
in a straightforward way.

Any hints are welcome.


*Geógrafo André Bertoncini*
Mestrando em Sensoriamento Remoto
Instituto Nacional de Pesquisas Espaciais
(48) 9178-0686

	[[alternative HTML version deleted]]

R-sig-Geo mailing list
R-sig-Geo <at> r-project.org
Martin Tomko | 18 Nov 14:55 2015

space-time - efficient creation of a TracksCollection

Dear list, cc Edzer,

I am trying to find an efficient method to read in data into a library(spacetime) TracksCollection, from a
large CVS containing gps tracks of individual objects.

I have managed to do this for a small number of tracks, following the documentation, using a
spatialPointsDataFrame spdf:
stidf = STIDF(geometry(spdf), spdf <at> data$timestamp, spdf <at> data)
T1 = Track(stidf)
etc for a number of Tracks, then mergins individual Track objects into Tracks for a given user
O1 = Tracks(list(T1=T1,T2=T2))
and then making a collection
Tr = TracksCollection(list(O1=O1,O2=O2)) of individual objects
Now - this is very cumbersome. I have potentially thousands of objects tracked, each with a number of
tracks. They are all stored in one large CSV annotated by timestamp, objectid and trackid. Is there any
efficient method to parse (even thorugh any other sp object) collections? The manual assignment of o1=
o1, o2=o2 etc is the main problem, from my perspective. I would like to supply a vector of names of users, and
a list of names of tracks (each are unique in the whole set) to this.

I can loop through the list of data frames for each individual Track before they are coerced into
spatialPointDataFrame, and I can get the additional labels - I see this as a way to append a new STI to
appropriate Tracks and to the collection?

Any hint welcome.



	[[alternative HTML version deleted]]
(Continue reading)