[MapProxy] WMS-C as a source

Oliver Tonnhofer olt at omniscale.de
Thu Mar 8 13:11:01 EST 2012

On 07.03.2012, at 22:19, Jeff Konnen wrote:
> for the record I've worked around this issue by adding the following:
>    def open_image(self, url, data=None):
>        resp = self.open(url, data=data)
>        if 'content-type' in resp.headers:
>            if not resp.headers['content-type'].lower().startswith('image'):
>                if resp.read().find("no-data")>-1:
>                    raise HTTPClientError('no-data exeception',-999)
>                else:
>                    raise HTTPClientError('response is not an image: (%s)' % (resp.read()))
>        return ImageSource(resp)

This "no-data" is unfortunately not a standard error code :)
But maybe it is a good idea to set the internal response code to 500 in case it did not get an image back?

Oliver Tonnhofer    | Omniscale GmbH & Co KG    | http://omniscale.de
http://mapproxy.org | https://bitbucket.org/olt | @oltonn

More information about the MapProxy mailing list