Exception when Clip = true for WMS source
When a WMS source is configured with "Clip = true", and a bounding box extent for the source, an exception occurs:
Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/mapproxy/wsgiapp.py", line 193, in call resp = self.handlers[handler_name].handle(req) File "/usr/lib/python2.7/dist-packages/mapproxy/service/ows.py", line 38, in handle return self.services[service].handle(req) File "/usr/lib/python2.7/dist-packages/mapproxy/service/base.py", line 30, in handle return handler(parsed_req) File "/usr/lib/python2.7/dist-packages/mapproxy/service/wms.py", line 142, in map bbox=query.bbox, bbox_srs=params.srs, coverage=coverage) File "/usr/lib/python2.7/dist-packages/mapproxy/image/merge.py", line 84, in merge img = mask_image(img, bbox, bbox_srs, layer_coverage) File "/usr/lib/python2.7/dist-packages/mapproxy/image/mask.py", line 33, in mask_image geom = mask_polygons(bbox, SRS(bbox_srs), coverage) File "/usr/lib/python2.7/dist-packages/mapproxy/image/mask.py", line 42, in mask_polygons return flatten_to_polygons(coverage.geom) File "/usr/lib/python2.7/dist-packages/mapproxy/util/geom.py", line 248, in flatten_to_polygons if geometry.type == 'Polygon': AttributeError: 'NoneType' object has no attribute 'type' [info] 127.0.0.1 - - [11/Feb/2019 16:19:10] "GET /service?service=WMS&request=GetMap&version=1.3.0&crs=EPSG:4326&layers=CIB-NY&styles=&transparent=TRUE&format=image/png&width=512&height=512&bbox=44.15625,-75.09375,44.4375,-74.8125 HTTP/1.1" 500 -
Config file contains:
layers:
- name: CIB-NY title: CIB-NY sources: [cib_cache]
caches: cib_cache: grids: [gridCIB] sources: [cibny_source] cache: type: mbtiles
sources: cibny_source: type: wms wms_opts: featureinfo: True req: url: http://localhost/cgi-bin/mapserv? layers: CIBNYI7k transparent: true format: image/tiff coverage: clip: true bbox: [-75.5086294, 43.9872123, -74.9969543, 44.5120205] srs: 'EPSG:4326' supported_srs: ['EPSG:4326']
Context
In mapproxy/image/merge.py, at line 83, if 'layer_coverage.clip' is true, 'mask_image' is called with 'layer_coverage' defined to be a bounding box object. But eventually, 'layer_coverage.geom' is referenced, and it's not defined.
Your Environment
- Version used: 1.11
- Environment name and version: Python 2.7.15
- Server type and version: Apache2 2.4.29, libapache2-mod-wsgi 4.5.17-1
- Operating System and version: Ubuntu 18.04
I also have the same bug with coverages with intersection at WMS sources.
coverage:
clip: true
intersection: [*data_src_test, *data_src_test2]
Is it possible when seeding or calling that an empty tile is created? When seeding, the task will be skipped if the result is empty in the intersection?
I've found the same issue on Ubuntu 20.04, Python 3.8 and Mapproxy 1.15.1. Is there any solution?