Write HTML file with appropriate extension config.
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
@@ -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},
|
||||||
|
|||||||
Reference in New Issue
Block a user