From ed8e2f999148e15869720b3bbb830260041ee5d3 Mon Sep 17 00:00:00 2001 From: David Manthey Date: Wed, 3 Oct 2018 10:39:54 -0400 Subject: [PATCH] Only call getLargeImagePath once in the mapnik tilesource. --- server/tilesource/mapniksource.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/server/tilesource/mapniksource.py b/server/tilesource/mapniksource.py index 40dff9300..369cee40d 100644 --- a/server/tilesource/mapniksource.py +++ b/server/tilesource/mapniksource.py @@ -54,7 +54,8 @@ class MapnikTileSource(FileTileSource): def __init__(self, path, projection=None, style=None, unitsPerPixel=None, **kwargs): super(MapnikTileSource, self).__init__(path, **kwargs) self._bounds = {} - self.dataset = gdal.Open(self._getLargeImagePath()) + self._path = self._getLargeImagePath() + self.dataset = gdal.Open(self._path) self.tileSize = 256 self.tileWidth = self.tileSize self.tileHeight = self.tileSize @@ -415,13 +416,9 @@ def addStyle(self, m, layerSrs, extent): lyr = mapnik.Layer('layer') lyr.srs = layerSrs if extent: - lyr.datasource = mapnik.Gdal( - base='', file=self._getLargeImagePath(), - band=band, extent=extent) + lyr.datasource = mapnik.Gdal(base=None, file=self._path, band=band, extent=extent) else: - lyr.datasource = mapnik.Gdal( - base='', file=self._getLargeImagePath(), - band=band) + lyr.datasource = mapnik.Gdal(base=None, file=self._path, band=band) lyr.styles.append('Raster Style') m.layers.append(lyr)