0

Write HTML file with appropriate extension config.

This commit is contained in:
Alex Jurkiewicz
2010-09-27 22:10:23 +10:00
parent 244679a877
commit e6bfcc3033
2 changed files with 5 additions and 3 deletions

View File

@@ -112,13 +112,15 @@ class QuadtreeGen(object):
print "{0}/{1} tiles complete on level {2}/{3}".format( print "{0}/{1} tiles complete on level {2}/{3}".format(
complete, total, level, self.p) complete, total, level, self.p)
def write_html(self, zoomlevel): def write_html(self, zoomlevel, imgformat):
"""Writes out index.html""" """Writes out index.html"""
templatepath = os.path.join(os.path.split(__file__)[0], "template.html") templatepath = os.path.join(os.path.split(__file__)[0], "template.html")
html = open(templatepath, 'r').read() html = open(templatepath, 'r').read()
html = html.replace( html = html.replace(
"{maxzoom}", str(zoomlevel)) "{maxzoom}", str(zoomlevel))
html = html.replace(
"{imgformat}", str(imgformat))
with open(os.path.join(self.destdir, "index.html"), 'w') as output: with open(os.path.join(self.destdir, "index.html"), 'w') as output:
output.write(html) output.write(html)
@@ -263,7 +265,7 @@ class QuadtreeGen(object):
else: else:
pool = multiprocessing.Pool(processes=procs) pool = multiprocessing.Pool(processes=procs)
self.write_html(self.p) self.write_html(self.p, self.imgformat)
# Render the highest level of tiles from the chunks # Render the highest level of tiles from the chunks
results = collections.deque() results = collections.deque()

View File

@@ -14,7 +14,7 @@
<script type="text/javascript"> <script type="text/javascript">
var config = { var config = {
path: 'tiles', path: 'tiles',
fileExt: 'png', fileExt: '{imgformat}',
tileSize: 384, tileSize: 384,
defaultZoom: 1, defaultZoom: 1,
maxZoom: {maxzoom}, maxZoom: {maxzoom},