Skip to content
Permalink
Browse files

Fix single threaded use of MBTiles generator

(cherry picked from commit cfbe664)
  • Loading branch information
Martin Schitter authored and nyalldawson committed Nov 8, 2019
1 parent e6ef226 commit 6838c185ed8b988df34d7d4e24cf1bbe9707cc85
Showing with 5 additions and 2 deletions.
  1. +5 −2 python/plugins/processing/algs/qgis/TilesXYZ.py
@@ -23,6 +23,7 @@

import os
import math
import re
from uuid import uuid4

import sqlite3
@@ -178,6 +179,7 @@ def initAlgorithm(self, config=None):
minValue=1,
maxValue=20,
defaultValue=4))
self.thread_nr_re = re.compile('[0-9]+$') # thread number regex

def prepareAlgorithm(self, parameters, context, feedback):
project = context.project()
@@ -190,10 +192,11 @@ def renderSingleMetatile(self, metatile):
return
# Haven't found a better way to break than to make all the new threads return instantly

if "Dummy" in threading.current_thread().name: # single thread testing
if "Dummy" in threading.current_thread().name or len(self.settingsDictionary) == 1: # single thread testing
threadSpecificSettings = list(self.settingsDictionary.values())[0]
else:
threadSpecificSettings = self.settingsDictionary[threading.current_thread().name[-1]] # last number only
thread_nr = self.thread_nr_re.search(threading.current_thread().name)[0] # terminating number only
threadSpecificSettings = self.settingsDictionary[thread_nr]

size = QSize(self.tile_width * metatile.rows(), self.tile_height * metatile.columns())
extent = QgsRectangle(*metatile.extent())

0 comments on commit 6838c18

Please sign in to comment.
You can’t perform that action at this time.