1

I'm trying get an imagen GTIFF with OWSLib in Python but I get error. Would you help me?

Code:

from owslib.wcs import WebCoverageService
wcs = WebCoverageService('http://maps.isric.org/mapserv?map=/map/phh2o.map', version='1.0.0')

bbox = (-54.7968690628577, -28.35600162342199, -54.77831702365789, -28.33600341642725)

response = wcs.getCoverage(
    identifier='phh2o_0-5cm_mean', 
    crs='urn:ogc:def:crs:EPSG::4326',
    bbox=bbox, 
    resx=250, resy=250, 
    format='GEOTIFF_INT16')

response.read()

Output:

b'\n<ServiceExceptionReport version="1.2.0"\nxmlns="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/wcs/1.0.0/OGC-exception.xsd">\n msImageCreate(): Image handling error. Attempt to allocate raw image failed, out of memory.\n \n\n'

2
  • You are exceeding the limits of the server so you will need to request two (or more) smaller images and combine them on your machine
    – Ian Turton
    Commented Sep 8, 2020 at 7:44
  • That bounding box is in the south Atlantic. There are no land masses there, you will just get an empty map. Commented Sep 8, 2020 at 9:04

1 Answer 1

1

On your request, you are working with EPSG:4326 which is a geographic coordinate system using degrees. The request resx=250, resy=250 asks for a grid with a resolution of 250 degrees, and the server will try to read all data and make an aggregated grid and reporting an out of memory.

If you try something like 0.001

response = wcs.getCoverage(
    identifier='phh2o_0-5cm_mean', 
    crs='urn:ogc:def:crs:EPSG::4326',
    bbox=bbox, 
    resx=0.001 , resy=0.001, 
    format='GEOTIFF_INT16')

You will be more successful obtaining a grid (resolution around 111 meters, depending where you are on the planet).

1
  • Thank you! it worked for me
    – kakripr
    Commented Sep 11, 2020 at 17:58

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.