How to use the WTSS client for R

Victor Maus and Alber Sanchéz

2017-12-21

Introduction

The Web Time Series Service (WTSS) is a lightweight web service which is able to retrieve remote sensing imagery as time series. WTSS bridges the gap between remote sensing applications and their data-access through a simple representation of time series data. The service main goal is to bring to remote sensing research community an easy way for accessing and consuming satellite imagery data in the form of time series, saving researchers’ time when dealing with a huge volume of data.

WTSS is based on three operations:

  1. list_coverages: returns the list of all available coverages in the service.
  2. describe_coverage: returns the metadata of a given coverage.
  3. time_series: query the database for the list of values for a given location and time interval.

This web service is integrated into thorugh the package . This document explains the basic functionality of the package.

Explore the service

To explore the contents of a , you need to create a client object by providing the URL of the service and then using the function for listing coverages. To create a WTSS connection, the user should point to a WTSS service. The Brazilian National Institute for Space Research (INPE) provides one such service, at the URL listed below.

library(wtss) # R package name is wtss
# Connect to a WTSS server
ts.server <- WTSS("http://www.dpi.inpe.br/tws/wtss")

The result of this operation is an object of Class WTSS.

ts.server
## Object of Class WTSS

## serverUrl:  http://www.dpi.inpe.br/tws/wtss 
## listCoverages: MOD13Q1 itobi merge mod13q1_512

After that, we are able to acquire the coverage metadata. This function returns a named list containing the attributes of a coverage. In the example below, we can see how to get metadata from the coverage named “mod13q1_512”, which contains time series from MODIS Land Collection 5 for all of South America.

coverage.name <- "mod13q1_512"
cv <- describeCoverage(ts.server, coverage.name)
bands <- cv[[names(cv)]]$attributes$name
bands
## [1] "ndvi" "evi"  "red"  "nir"  "blue" "mir" 

# print information about the data
cv$mod13q1_512$description
# [1] "Vegetation Indices 16-Day L3 Global 250m"

Retrieve data

To retrieve data, you need to specify the coverage names, the bands, latitude and longitude and the time interval :

# get a time series for the "ndvi" attribute
time_series <- wtss::timeSeries(ts.server, coverages = "mod13q1_512", attributes=c("ndvi", "evi"), 
                      latitude=-10.408, longitude=-53.495, 
                      start="2000-02-18", end="2017-02-18")

# Plot the time series
plot(ts[[1]]$attributes[,1], main=sprintf("Pixel Center Coordinates Time-Series (%5.3f, %5.3f)", ts[[1]]$center_coordinate$latitude, ts[[1]]$center_coordinate$longitude), xlab="Time", ylab="Normalized Difference Vegetation Index")

The time series can then be used together with other packages in R. Please take a look at demos provided with the WTSS package, which show how to use a time series of the NDVI index together with different packages to detect when deforestation occurred in the Brazilian Amazon rain forest.