Skip to content

Commit

Permalink
Set extent CRS to Project CRS
Browse files Browse the repository at this point in the history
Tiles creation assumed extent crs was the same as project crs this pr adds a transform to get it to work if that is not the case.
  • Loading branch information
baswein authored and nyalldawson committed Apr 24, 2023
1 parent 8282b66 commit 3d6e1e5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions python/plugins/processing/algs/qgis/TilesXYZ.py
Expand Up @@ -239,7 +239,14 @@ def generate(self, writer, parameters, context, feedback):
self.feedback = feedback
feedback.setProgress(1)

extent = self.parameterAsExtent(parameters, self.EXTENT, context)
project = context.project()

# Transform extent to match project CRS
extent_original = self.parameterAsExtent(parameters, self.EXTENT, context)
extent_crs = self.parameterAsExtentCrs(parameters, self.EXTENT, context)
self.extentCrsToProjectCrs = QgsCoordinateTransform(extent_crs, project.crs(), context.transformContext())
extent = self.extentCrsToProjectCrs.transformBoundingBox(extent_original)

self.min_zoom = self.parameterAsInt(parameters, self.ZOOM_MIN, context)
self.max_zoom = self.parameterAsInt(parameters, self.ZOOM_MAX, context)
dpi = self.parameterAsInt(parameters, self.DPI, context)
Expand All @@ -258,7 +265,6 @@ def generate(self, writer, parameters, context, feedback):
wgs_crs = QgsCoordinateReferenceSystem('EPSG:4326')
dest_crs = QgsCoordinateReferenceSystem('EPSG:3857')

project = context.project()
self.src_to_wgs = QgsCoordinateTransform(project.crs(), wgs_crs, context.transformContext())
self.wgs_to_dest = QgsCoordinateTransform(wgs_crs, dest_crs, context.transformContext())
# without re-writing, we need a different settings for each thread to stop async errors
Expand Down

0 comments on commit 3d6e1e5

Please sign in to comment.