In QGIS, I have a WMS layer. I am saving it to my hard drive by right click > "Save As...". Just like in HDunn's answer here. This is about my understanding of the topic, already this code is strange and not really understandable for me.

However, "Save As..." is resampling the original data by averageing it, which is not OK for me since the original raster is a categorical one. I do not know the resolution of the original WMS file (it is not included in it's description).

How could I save it with either the original resolution (and CRS) and/or with other resampling method than averaging? Natural Neighbour would be fair enough although Most Frequent Value would be most accurate. Is that possible without Python? I also understand of R, if that helps.

The WMS URL is: https://maps.rissac.hu:6443/arcgis/services/dosoremi_web_mercator/MapServer/WMSServer?LAYERS=4&PROJECTION=EPSG%3A3857&TRANSPARENT=TRUE&VERSION=1.1.1

  • 2
    WMS is not really a standard intended for accessing raw data, only a representation of the data. The URL you give is not the URL of the service, a client would just want https://maps.rissac.hu:6443/arcgis/services/dosoremi_web_mercator/MapServer/WMSServer? a human might want to read https://maps.rissac.hu:6443/arcgis/services/dosoremi_web_mercator/MapServer/WMSServer?service=WMS&request=GetCapabilities&
    – nmtoken
    Dec 11, 2018 at 11:10
  • You might find that the WMS gives a TIFF as output, so no need to save as, just request it.
    – nmtoken
    Dec 11, 2018 at 11:12
  • You can do it in GRASS GIS, with the r.in.wms function. It is not difficult but you must know how to create projects in Grass. Dec 11, 2018 at 23:42

2 Answers 2


For a reference of the GeoServer WMS services:


Get server capabilities:


The server returns an XML file, open it with a web browser.
Assuming you want to download layer 4, these are the parts that interest you:

            <OnlineResource xlink:type="simple" xlink:href="https://maps.rissac.hu:6443/arcgis/services/dosoremi_web_mercator/MapServer/WmsServer?"/>
<Layer queryable="1">
<Title>Agyagtartalom (%, 0-30 cm)</Title>
<!-- alias 3857 -->
<LatLonBoundingBox minx="16.015936" miny="45.676268" maxx="22.941947" maxy="48.610464"/>
<BoundingBox SRS="EPSG:4326" minx="16.015936" miny="45.676268" maxx="22.941947" maxy="48.610464"/>
<BoundingBox SRS="EPSG:3857" minx="1782885.857099" miny="5728621.889700" maxx="2553885.857099" maxy="6209021.889700"/>
<BoundingBox SRS="EPSG:102100" minx="1782885.857099" miny="5728621.889700" maxx="2553885.857099" maxy="6209021.889700"/>

There you can find the available image formats, the reference systems and the regions (expressed in those reference systems), which you can request.

Assuming you want to obtain a TIFF file in EPSG:4326 system, of the region between latitudes 20.3 and 20.4 degrees, and longitudes between 48.0 and 48.1 degrees, with a resolution of 0.0001 degree (a grid of 1000 rows and 1000 columns).
The region is small enough to be able to download quickly and the resolution is good enough, probably the maximum that the server can provide (observe the pixels in QGIS, in the WMS layer, and its size in WGS84 coordinates).
Then, when looking at wider regions, keep in mind that you should not exceed the limits set by the server, or return an error.

The GetMap way

You can request that map through a web browser, typing the URL of the GetMap query:


The server will return a TIFF file with the requested map, but without referencing.
When you add it as a raster layer to QGIS, it will ask you to specify the reference system and project the image onto the canvas.
The result is that QGIS will place the image in latitude 0 and longitude 0, and the image will measure 1000 degrees wide by 1000 degrees long.
You must georeference it.


Assuming you already have your Location and Mapset determined to work on EPSG:4326, the first step is to establish the region:

g.region n=48.1 s=48 e=20.4 w=20.3 rows=1000 cols=1000  

I'm going to copy the commands already formed, but if you run just g.region a GUI is open that can help you in the process of setting the parameters.

You can verify that the region was created and loaded as the default region with the command g.region -p.

Then, download the image from the server:

r.in.wms --overwrite url=https://maps.rissac.hu:6443/arcgis/services/dosoremi_web_mercator/MapServer/WMSServer? output=anytestname layers=4 format=tiff  

GRASS GIS will connect to the server, download the map and load it to the canvas.
It is a good idea to check the information on the map:

r.info map=anytestname@themapsetname  

According to the documentation of g.out.gdal, the data type for the output of raster values ​​between 0 and 65535 can be UInt16, therefore the output command can be:

r.out.gdal --overwrite input=anytestname@themapsetname output=C:\somefile.tiff format=GTiff type=UInt16  

And that's it, when you load the image as a raster layer in QGIS, you will not notice any difference with the WMS layer.

I recommend that you do not intend to download very large regions with this resolution. Note that the WMS layer requests different resolutions depending on the zoom level, and when the zoom level is high the regions are small.

  • Thank you for the thorough answer. How can I check the best resolution of the WMS raster (in addtion to "observing" the pixels when zooming it very much)? Dec 12, 2018 at 12:23
  • You are welcome. The WMS server does not give that information, except that whoever configures it adds it as metadata of the Layer section, in the Abstract tag, returned with the GetCapabilities method. But seeing the page http://dosoremi.hu/int_agyag_0_30.html, they publish Térbeli felbontás: 100 x 100 m, I would think that is is the minimum size of the pixel. Dec 12, 2018 at 15:08

Use GetMap method of the WMS Service. You can find the query parameters in the internet. after fetching the image you can create the world file to georeference it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.