ExtractFile: Extract time series from a list of images

Description Usage Arguments Details Value Warning Author(s) See Also Examples

Description

Extract time series from a file containing a list of images

Usage

1
2
ExtractFile(shapefile, shapedir, listfile, outfile, period, 
    shapeext = "shp")

Arguments

shapefile

name of the shape/kml file with multi-points or polygons from where time series are extracted.
For a shapefile called ‘name.shp’ , shapefile="name".
For a kml file, write the name of the layer.

shapedir

path to the shape/kml file.
For a shapefile, shapedir is the path to the folder containing the shapefile. For example if the directory of the shapefile is ‘C:/Dir/name.shp’, shapefile="C:/Dir/".
For a kml file, shapedir is the full directory of the kml file. For example shapefile="C:/Dir/name.kml".
Please note that paths to files in R can be specified with either "/" or "\\" in Windows OS and "/" in UNIX OS.

listfile

file containing a list of images

outfile

name of the file where the time series are saved (extension ".txt").
By default, outfile = " .".

period

number of observation per year

shapeext

extension of the shape/kml file : "shp" for a Esri shapefile or "kml" for a kml file from Google earth .
By default, shapeext = "shp".

Details

listfile should respect the following format :
N
path\image1.tif
path\image2.tif
...
path\imageN.tif
with N the number of image files.

The list of images should be in chronological order, and include the complete path to the file, unless the files are located in the working directory from which R is run. Only the N first images in the file will be processed.

Value

Return the time series of the points/polygons in the shapefile over images in the shapefile.

Warning

It is the responsability of the user to have complete and ordered dataset : list of images have to be in chronological order and without missing image.

Author(s)

Romain Frelat and Bruno Gerard

See Also

TimeSeriesAnalysis,tolist

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#Be carefull : it is only an example !
#It is not the good way to extract time series
#when you have the maps in an accepted nomenclature.
#You should always prefer ExtractVGT, ExtractVITO or 
#ExtractGIMMS if possible

#local variables
ndvidirectory=paste(system.file("extdata/VITO_Mzimba",
    package="ndvits"), "/", sep="")
region="Mzimba"
Ystart=2004
Yend=2009
list="MzimbaList.txt"
period = 36
shape="SLP_Mzimba"
shapedir=paste(system.file("extdata/shape", package="ndvits"),
    "/", sep="")

#executing tolist to get a list
tolist(ndvidirectory, region, Ystart, Yend, 
    , outfile=list) 

#executing ExtractFiles
signal = ExtractFile(shape, shapedir, list, outfile="TS.txt",
    period = period)

ndvits documentation built on May 2, 2019, 4:47 p.m.

Related to ExtractFile in ndvits...