GRASS logo

NAME - Downloads and imports data from OGC WMS and OGC WMTS web mapping servers.


raster, import, OGC web services, OGC WMS, OGC WMTS

SYNOPSIS --help [-cob] url=string output=name layers=string[,string,...] [styles=string[,string,...]] [format=string] [srs=integer] [driver=string] [wms_version=string] [maxcols=integer] [maxrows=integer] [urlparams=string] [username=string] [password=string] [method=string] [gdal_createopt=string[,string,...]] [region=string] [bgcolor=string] [proxy=string] [proxy_user_pw=string] [capfile=name] [capfile_output=name] [--overwrite] [--help] [--verbose] [--quiet] [--ui]


Get the server capabilities, print them out, then exit
Do not request transparent data
Keep original bands (default: create composite)
Allow output files to overwrite existing files
Print usage summary
Verbose module output
Quiet module output
Force launching GUI dialog


url=string [required]
Typically starts with "http://"
output=name [required]
Name for output raster map
layers=string[,string,...] [required]
Layer(s) to request from the map server
Layer style(s) to request from the map server
Image format requested from the server
Options: geotiff, tiff, jpeg, gif, png, png8
Default: png
EPSG code of requested source projection
Default: 4326
Driver used for communication with the server
Default: WMS_GRASS
WMS_GDAL: Download data using GDAL WMS driver
WMS_GRASS: Download data using native GRASS-WMS driver
WMTS_GRASS: Download data using native GRASS-WMTS driver
OnEarth_GRASS: Download data using native GRASS-OnEarth driver
WMS standard version
Options: 1.1.0, 1.1.1, 1.3.0
Default: 1.1.1
Maximum columns to request at a time
Default: 512
Maximum rows to request at a time
Default: 512
Additional query parameters to pass to the server
Username for server connection
Password for server connection
Interpolation method to use in reprojection
Options: nearest, linear, cubic, cubicspline
Default: nearest
GDAL creation option(s) to pass to the output format driver
In the form of "NAME=VALUE", separate multiple entries with a comma
Request data for this named region instead of the current region bounds
Background color
Format: 0xRRGGBB
HTTP proxy only GDAL driver (GDAL_HTTP_PROXY)
HTTP proxy
User and password for HTTP proxy only for GDAL driver (GDAL_HTTP_PROXYUSERPWD). Must be in the form of [user name]:[password].
User and password for HTTP proxy
Capabilities file to parse (input). It is relevant for WMTS_GRASS and OnEarth_GRASS drivers
File where the server capabilities will be saved ('c' flag)

Table of contents

DESCRIPTION handles all of downloading and importing raster data from OGC WMS and OGC WMTS web mapping servers. It only needs be told the desired data to collect (bounds and resolution) via a region, the server to get the data from, and the layer or layers to get. It downloads the data in tiles, reprojects it, imports it, and patches it back together.


To understand the data you are getting it is necessary to look at the capabilities of the WMS server. This should be available via a capabilities request (see examples)

If possible, the EPSG code of the current location should be used with the srs option to avoid unnecessary reprojection.

When using GDAL WMS driver (driver=WMS_GDAL), the GDAL library needs to be built with WMS support, see GDAL WMS manual page for details.

Tiled WMS

Into the parameter layers the name of the TiledGroup need to be inserted from Tile Service file. Time variable can be specified in urlparams parameter, e.g: urlparams='time=2012-1-1'.


General Get Capabilities Request

# Topographic WMS with OpenStreetMap by mundialis -c url="" -c url="" | grep Name

# Czech WMS -c url=""

Download raster data from WMS server (GetMap request)

Open Street Map

# OSM, using WMS_GRASS driver
g.region n=90 s=-90 w=-180 e=180 res=0:10:00 -p url="" layers=osm_auto:all output=osm format=png osm
# OSM Overlay WMS (can be used as an overlay for other maps) url="" layer=OSM-Overlay-WMS output=osm_overlay format=png

# TOPO-OSM-WMS url="" layer=TOPO-OSM-WMS output=topo_osm format=png topo_osm

# TOPO-WMS url="" layer=TOPO-WMS output=topo format=png topo

More OSM WMS servers can be found online, e.g. on the OSM wiki in a OSM WMS Servers list and on the OSM-WMS-EUROPE page.

Countries and coastlines

# using WMS_GRASS driver url="" layers=Countries,Borders,Coastline output=countries srs=4326 format=png countries

Sentinel-2 satellite cloud free global coverage

# North Carolina sample data
g.region raster=elevation -p
# using WMS_GRASS driver url="" layers=s2cloudless output=sentinel2 format=png sentinel2

Figure: Raleigh (NC, USA) seen by Sentinel-2 (10m resolution; image courtesy: EOX)

OGC WMTS Example

# using WMTS_GRASS driver url="" layers=ORTHOIMAGERY.ORTHOPHOTOS \
         output=orthophoto srs=3857 format=jpeg driver=WMTS_GRASS style=normal password="*" username="*" orthophoto
Note: username, password and API key can be obtained from IGN API website

Data covering the Czech Republic

# using WMS_GRASS driver url="" layers=prehledka_kraju-linie srs=4326 output=kn format=png
# using WMTS_GRASS driver url="" layers=orto output=orthophoto \
         srs=3857 format=jpeg driver=WMTS_GRASS style=default orthophoto
Note: data are provided by Czech office for surveying, mapping and cadastre.

Satellite data covering Europe

Copernicus Core003 View Services - Optical VHR2 coverage over EU 2011-2013 (provided by JRC; usage is restricted to non-commercial activities):
# get WMS layer list -c url="" -c url="" | grep Name

# spatial subset of Europe
# enlarging maxcols and maxrows in order to minimize impact of copyright notice in map
g.region n=56 s=47 w=5 e=16 res=0:00:10 -pa
# using WMS_GRASS driver url="" \
         layer="OI.Mosaic.NaturalColor.Feathering" output="jrc_copernicus_core003_mosaik" \
         maxcols=3400 maxrows=3400 jrc_copernicus_core003_mosaik

# Alternatively, using WMS_GDAL driver with BIGTIFF and compression enabled url="" \
         layer="OI.Mosaic.NaturalColor.Feathering" output="jrc_copernicus_core003_mosaik2" \
         maxcols=3400 maxrows=3400 driver=WMS_GDAL gdal_createopt="BIGTIFF=YES,COMPRESS=DEFLATE" jrc_copernicus_core003_mosaik2

REQUIREMENTS requires the gdalwarp utility from the GDAL/OGR library.


SEE ALSO, r.patch, r.colors, r.composite,

See also WMS support in wxGUI.


Stepan Turek, Czech Technical University in Prague, Czech Republic
(bachelor's final project 2012, mentor: Martin Landa)


Available at: source code (history)

Latest change: Wednesday Mar 01 21:08:00 2023 in commit: 1a96f69ccf430caa03bec8dbfc990c07c81f3164

Main index | Raster index | Topics index | Keywords index | Graphical index | Full index

© 2003-2024 GRASS Development Team, GRASS GIS 8.3.3dev Reference Manual