8.3 Geographic Web Services

Open Geospatial Consortium (OGC) specifications, or OWS provide for a standardized

  • Web Feature Service
  • Web Map Service
  • Web Map Tile Service
  • Web Coverage Service
  • Web Processing Service

Map servers such as PostGIS have adopted these uniform protocols.

The format is generally a ‘base URL’, an ‘endpoint’ and ‘URL query arguments’ following a ?

library(httr)
base_url <- "http://www.fao.org"
endpoint <- "/figis/geoserver/wfs"
q <- list(request = "GetCapabilities")
res <- GET(url = modify_url(base_url, path = endpoint), query = q)
res$url
#> [1] "https://www.fao.org/figis/geoserver/wfs?request=GetCapabilities"

Available names differ depending on the accessed web feature service.

One way of extracting the contents of the request is

txt <- content(res, "text")
xml <- xml2::read_xml(txt)

The package ows4R was developed for working with OWS services.

via GIPHY