1

I'm trying to retrieve DSM/DTM data from UK DEFRA WMS services in order to render in 3D. My background is in programming rather than GIS, although I've been dabbling a bit for a little while.

I have previously downloaded a number of tiles in zipped ASC format, and have scripts for processing these and rendering them (side-note: I think DEFRA have started using GeoTIFF with 32bit floats for some more recent data sets, but I haven't had much luck interpreting that data - I haven't tried very hard thus far as I had a working pipeline for the ASC that was enough for initial experiments).

I haven't been able to find a way to acquire this format of data en-masse, and using the graphical interface to do so manually is quite laborious. I thought that querying via WMS should be able to get me what I want, but I can only get it to return coloured images geared towards human eyes, whereas I would like to have a single value representing some reasonably precise height (FWIW, I've been processing height read from ASC normalised into 24bit unsigned ints in JPEG2000 images, along with metadata about how to rescale to min/max elevation for each tile).

I am able to query the WMS, eg

https://environment.data.gov.uk/spatialdata/lidar-composite-digital-surface-model-dsm-1m/wms?service=WMS&
  request=GetMap&version=1.3&layers=LIDAR_Composite_DSM_1m&
  styles=&format=image/jpeg&transparent=false&height=500&width=500&
  srs(crs)=EPSG:27700&bbox=448000.5, 129000.5, 448500.5, 129500.5

example DSM image

Other formats for GetMap available, as per GetCapabilities:

            <GetMap>
                <Format>image/bmp</Format>
                <Format>image/jpeg</Format>
                <Format>image/tiff</Format>
                <Format>image/png</Format>
                <Format>image/png8</Format>
                <Format>image/png24</Format>
                <Format>image/png32</Format>
                <Format>image/gif</Format>
                <Format>image/svg+xml</Format>

I'm pretty sure none of these are likely to be able to give me more than 8bits of information, and even then in a form requiring other processing. I imagine that styles is a parameter that might sometimes be used for selecting a plain elevation representation rather than coloured, but I don't see evidence of any different styles being available in the GetCapabilities output.

            <GetFeatureInfo>
                <Format>application/vnd.esri.wms_raw_xml</Format>
                <Format>application/vnd.esri.wms_featureinfo_xml</Format>
                <Format>application/vnd.ogc.wms_xml</Format>
                <Format>application/geojson</Format>
                <Format>text/xml</Format>
                <Format>text/html</Format>
                <Format>text/plain</Format>

Seems like it could be useful, but my attempts to query it all seem to return errors. e.g.

https://environment.data.gov.uk/spatialdata/lidar-composite-digital-surface-model-dsm-1m/wms?service=WMS&
  request=GetFeatureInfo&version=1.3&layers=LIDAR_Composite_DSM_1m&
  format=text/plain&height=500&width=500&srs(crs)=EPSG:27700&
  bbox=448000.5, 129000.5, 448500.5, 129500.5&
  InfoFormat=text/plain

yields

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<ServiceExceptionReport version="1.3.0"
  xmlns="http://www.opengis.net/ogc"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wms/1.3.0/exceptions_1_3_0.xsd">
    <ServiceException code="LayerNotDefined">
Parameter 'layers' can not be empty.
  </ServiceException>
    <ServiceException code="InvalidFormat">
Parameter 'InfoFormat' contains unacceptable value.
  </ServiceException>
</ServiceExceptionReport>

for reasons I don't understand. I've tried a few different values for InfoFormat & layers, but to no avail.

I'm still not quite sure whether a better formed query to GetFeatureInfo will give me the data I'm after, or whether I need to persue other options anyway.

3
  • 1
    fyi: There is a lot of data here using arcgis online environment.data.gov.uk/arcgis/rest/services/SURVEY (qgis can read this too)
    – Mapperz
    Commented Oct 18, 2020 at 2:10
  • Thanks @Mapperz, that's interesting - although thus far I've only got it to show me catalogues... I can see entries with tantalising information like processed_relative_path: COMPOSITE_LIDAR\2019\Zip_Files\1m\DTM\LIDAR-DTM-1m-2019-SV80sw.zip. I don't know if these files are exposed to the public internet, but if so, and if I could figure out what that path was relative to, I could scrape the data I want... Probably better to ask on their forum.
    – PeterT
    Commented Oct 18, 2020 at 16:47
  • There is a video here ea.sharefile.com/share/view/s6c1e0bb7c8548948 of the manual process - wget can retrieve a list of zip files and download them for the area of interest. example: environment.data.gov.uk/UserDownloads/interactive/…
    – Mapperz
    Commented Oct 18, 2020 at 17:29

1 Answer 1

1

You are mixing format and info_format - to produce a valid getFeatureInfo request you need to take a valid getMap request and add the extra getFeatureInfo parameters, that are then used to work out which pixel you are asking for.

So your request should be something like:

https://environment.data.gov.uk/spatialdata/lidar-composite-digital-surface-model-dsm-1m/wms?service=WMS&request=GetFeatureInfo&version=1.3&layers=LIDAR_Composite_DSM_1m&format=img/png&height=500&width=500&crs=EPSG:27700&bbox=448000.5,129000.5,448500.5,129500.5&query_layers=LIDAR_Composite_DSM_1m&info_format=text/plain&I=10&J=39

where I and J are the "coordinates" of the pixel you are interested in (from the top left corner).

This is probably not what you want to do as it will not be very accurate or fast to query the map pixel by pixel. You need to contact the data supplier and ask them for details of their Web Coverage Service (WCS) which provides a way to download the actual data in a variety of formats.

5
  • Many thanks. Ah yes, I'd left format in there with a spurious value, although I think I'd already tried various permutations of format and InfoFormat: I certainly hadn't tried info_format and am not sure how the error message would have lead me to ever do so. I still get a LayerNotDefined exception with the message Parameter 'layers' cannot be empty. While it'd be nice to get a working query, you're absolutely right that I don't want to be querying pixel-by-pixel, so will try asking on their forum about WCS etc.
    – PeterT
    Commented Oct 17, 2020 at 13:13
  • I've just tested and fixed the URL in my answer - that is a very expensive and very crap WMS (typical government junk)
    – Ian Turton
    Commented Oct 17, 2020 at 14:07
  • Leaves something to be desired, certainly, but it’s a shining example compared to other uk government IT infrastructure bbc.co.uk/news/technology-54423988
    – PeterT
    Commented Oct 17, 2020 at 16:26
  • Aaargh, and having just run your request I see that it returns @LIDAR_Composite_DSM_1m Red;Green;Blue; 185;236;33; anyway, at least I know that it’s not entirely my lack of knowledge that’s to blame.
    – PeterT
    Commented Oct 17, 2020 at 16:30
  • Not entirely your fault, the layers is empty error threw me for a bit too, since it was referring to the query_layers parameter
    – Ian Turton
    Commented Oct 17, 2020 at 18:16

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.