OWSLib icon indicating copy to clipboard operation
OWSLib copied to clipboard

[WMS] if layers parameter is provided as string owslib returns 'layer not found'

Open pvgenuchten opened this issue 2 years ago • 0 comments

we received an error report about a failing layer on our service by a user using owslib in the end it appeared the user added the layer to the owslib request as string in stead of array owslib probably sends of an empty layername and the service responds with 'layer-not-found' suggestion to let owslib evaluate if the layer is of type array and not empty before sending out the getmap request, else return a sensible error to the user

from owslib.wms import WebMapService
wms = WebMapService('https://maps.isric.org/mapserv?map=/map/af250m_nutrient.map')
img = wms.getmap(   layers='af250m_nutrient_al_m_agg30cm',
                    srs='EPSG:4326',
                    bbox=(-112, 36, -106, 41),
                    size=(300, 250),
                    format='image/jpeg',
                    transparent=True
                    )

pvgenuchten avatar Jun 09 '22 08:06 pvgenuchten