rOpenSearch - an R interface to OpenSearch

Geohazards and Synthetic Aperture Radar data

The Geohazard Supersites and Natural Laboratories Virtual Archive

Virtual Archives are online archives that provide an easy access to EO data by coupling high bandwidth, large storage space and software. European Space Agency's Virtual Archive 4 provides a Cloud based service for storing and providing access to ESA Synthetic Aperture Radar (SAR) data. This virtual archive represents ESA's contribution to the Geohazard Supersites and Natural Laboratories initiative. This huge amount of SAR data (today nearly ninty thousand products are hosted on Virtual Archive 4) is accessible to science communities dealing with interferometry, landslide and change detection.

The Virtual Archive's Web Interface is accessible here: http://eo-virtual-archive4.esa.int/

This example use rOpenSearch to query the Virtual Archive Envisat ASAR Image Mode Level 0 data for the 100 first dataset spanning time interval 2010-01-01 to 2010-01-31.

Load the required packages with:

# load the libraries
library(devtools)
library(rgdal)
library(rgeos)
library(XML)
library(rOpenSearch)

Define the OpenSearch description URL

osd.url <- "http://eo-virtual-archive4.esa.int/search/ASA_IM__0P/description"
  • Get the list of OpenSearch response types:
GetOSResponseFormats(osd.url)
## [1] "application/rdf+xml"                 
## [2] "text/plain"                          
## [3] "text/tab-separated-values"           
## [4] "text/html"                           
## [5] "application/vnd.google-earth.kml+xml"
## [6] "application/atom+xml"
  • Set the OpenSearch response type to use:
response.type <- "application/rdf+xml"
  • get the queryables dataframe from the OpenSearch description URL
df.params <- GetOSQueryables(osd.url, response.type)

Assign values to the queryables

df.params$value[df.params$type == "count"] <- 100 
df.params$value[df.params$type == "time:start"] <- "2010-01-01"
df.params$value[df.params$type == "time:end"] <- "2010-01-31"

Submit the query

res <- Query(osd.url, response.type, df.params)

Get the dataset

dataset <- xmlToDataFrame(nodes = getNodeSet(xmlParse(res), 
  "//dclite4g:DataSet"), stringsAsFactors = FALSE)

Create a SpatialPolygonsDataFrame with the dataset

poly.sp <- SpatialPolygonsDataFrame(readWKT(data.frame(dataset$spatial)[1,]), dataset[1,])

# iterate through the remaining dataset
for (n in 2:nrow(dataset)) {
  poly.sp <- rbind(poly.sp,
    SpatialPolygonsDataFrame(readWKT(data.frame(dataset$spatial)[n,],id=n), dataset[n,]))
}

write the geojson file

writeOGR(poly.sp, 'example1.geojson','dataMap', driver='GeoJSON')

The GeoJSON file can be see here: https://github.com/Terradue/rOpenSearch/blob/master/src/main/R/examples/example1.geojson