[MapProxy] mbtiles > KML SuperOverlay on Apache throws ValueError

Simeon Nedkov simeon at ndkv.nl
Mon Jul 8 14:12:44 PDT 2013


Hi list,

I'm new to MapProxy and am loving it thus far: it's easy to install and 
configure and it's very light and fast compared to GeoServer. I am, 
however, experiencing some inconveniences.

I am serving an mbtiles cache made with TileMill from a GeoTIFF as a KML 
SuperOverlay. I've setup a layer and the corresponding cache as:

layers:
   - name: vening
     title: vening
     sources: [vening_cache]

caches:
   vening_cache:
     sources: []
     grids: [GLOBAL_MERCATOR]
     cache:
       type: mbtiles
       filename: /home/ubuntu/mapproxy/data/vening.mbtiles

I've integrated MapProxy in Apache through mod_wsgi as

WSGIPythonHome /home/ubuntu/mapproxy
WSGIScriptAlias /mapproxy /home/ubuntu/mapproxy/mymapproxy/config.py

<Directory /home/ubuntu/mapproxy>
   Order deny,allow
   Allow from all
</Directory>

I fetch the KML SuperOverlay at
http://ec2-184-73-66-219.compute-1.amazonaws.com/mapproxy/kml/vening/EPSG900913/0/0/0.kml

and load it in Google Earth. The overlay itself is displayed perfectly 
fine: I can zoom in all the way and new tiles are retrieved as needed. 
However, I get a bunch of red crosses over the globe that is not covered 
by the overlay. When I follow one of the faulty URLs (for example 
http://ec2-184-73-66-219.compute-1.amazonaws.com/mapproxy/kml/vening/EPSG900913/6/37/18.png) 
for the first time I get a blank page i.e. a transparent .png. However, 
when I follow it a second time (thereby emulating a zoom or pan in 
Google Earth) I get an Internal Server Error. Opening the Apache log 
reveals a Python ValueError

[Mon Jul 08 21:00:15 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Mon Jul 08 21:00:15 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Mon Jul 08 21:00:15 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 
Python/2.7.3 configured -- resuming normal operations
[Mon Jul 08 21:00:28 2013] [error] [client 77.172.21.52] mod_wsgi 
(pid=16499): Exception occurred processing WSGI script 
'/home/ubuntu/mapproxy/mymapproxy/config.py'.
[Mon Jul 08 21:00:28 2013] [error] [client 77.172.21.52] Traceback (most 
recent call last):
[Mon Jul 08 21:00:28 2013] [error] [client 77.172.21.52]   File 
"/home/ubuntu/mapproxy/lib/python2.7/site-packages/mapproxy/wsgiapp.py", 
line 181, in __call__
[Mon Jul 08 21:00:28 2013] [error] [client 77.172.21.52]     return 
resp(environ, start_response)
[Mon Jul 08 21:00:28 2013] [error] [client 77.172.21.52]   File 
"/home/ubuntu/mapproxy/lib/python2.7/site-packages/mapproxy/response.py", line 
151, in __call__
[Mon Jul 08 21:00:28 2013] [error] [client 77.172.21.52] 
self.response.seek(0, 2) # to EOF
[Mon Jul 08 21:00:28 2013] [error] [client 77.172.21.52] ValueError: I/O 
operation on closed file

What is going on? I don't get these errors with the mapproxy-util 
serve-develop server: it simply returns transparent .png images all the 
time. I'm guessing that something is borked with my Apache 
configuration; I have little experience with it and especially mod_wsgi.

I'm running Apache 2.2.22 and MapProxy 1.5 (in a virtualenv) on Ubuntu 
12.04 (Amazon instance).

I've also given the apache user right to MapProxy's cache directories 
and the data directory that stores the mbtiles cache with
sudo chown www-data /path_to_cache
sudo chgrp www-data /path_to_cache

Any help is greatly appreciated!

Cheers,
Simeon

PS The map you see depicts the journey of Vening Meinesz, a Dutch 
geophysicist and geodesist who measured the Earth's gravity field from a 
submarine and thereby discovered continental drift 
(http://en.wikipedia.org/wiki/Felix_Andries_Vening_Meinesz).


More information about the MapProxy mailing list