Skip to content

Commit

Permalink
Bumped to 1.29.1 with Mapnik provider debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
migurski committed Mar 15, 2012
1 parent f9f3f42 commit 76218dc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
@@ -1,3 +1,6 @@
2012-03-15: 1.29.1
- Added debug logging to Mapnik provider.

2012-03-14: 1.29.0
- Added configurable HTTP referer header to URL Template provider.
- Added optional precision parameter to Vector provider for JSON output.
Expand Down
10 changes: 9 additions & 1 deletion TileStache/Providers.py
Expand Up @@ -70,6 +70,7 @@
"""

import os
import logging

from StringIO import StringIO
from posixpath import exists
Expand All @@ -81,6 +82,7 @@
from urllib import urlopen
import urllib2
from glob import glob
from time import time

try:
import mapnik2 as mapnik
Expand Down Expand Up @@ -251,6 +253,8 @@ def __init__(self, layer, mapfile, fonts=None):
def renderArea(self, width, height, srs, xmin, ymin, xmax, ymax, zoom):
"""
"""
start_time = time()

if self.mapnik is None:
self.mapnik = mapnik.Map(0, 0)

Expand All @@ -264,6 +268,8 @@ def renderArea(self, width, height, srs, xmin, ymin, xmax, ymax, zoom):

mapnik.load_map(self.mapnik, filename)
os.unlink(filename)

logging.debug('TileStache.Providers.Mapnik.renderArea() %.3f to load %s', time() - start_time, self.mapfile)

#
# Mapnik can behave strangely when run in threads, so place a lock on the instance.
Expand All @@ -278,7 +284,9 @@ def renderArea(self, width, height, srs, xmin, ymin, xmax, ymax, zoom):
global_mapnik_lock.release()

img = Image.fromstring('RGBA', (width, height), img.tostring())


logging.debug('TileStache.Providers.Mapnik.renderArea() %dx%d in %.3f from %s', width, height, time() - start_time, self.mapfile)

return img

class UrlTemplate:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
1.29.0
1.29.1

0 comments on commit 76218dc

Please sign in to comment.