Skip to content

Commit

Permalink
Corrected computation of center
Browse files Browse the repository at this point in the history
  • Loading branch information
gvellut committed Mar 5, 2018
1 parent f28db71 commit 593b8c1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions freehandrastergeoreferencer_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,12 @@ def initializeExistingGeoreferencing(self, dataset, georef):
# assume georef only has translation and scaling
# since rotation not supported by QGIS or ArcGIS
self.setRotation(0.0)
center = QgsPointXY(georef[0], georef[3])
sx, sy = georef[1], georef[5]
center = QgsPointXY(georef[0] + sx * self.image.width() / 2,
georef[3] + sy * self.image.height() / 2)
self.setCenter(center)
# keep yScale positive
self.setScale(georef[1], -georef[5])
self.setScale(sx, -sy)
self.commitTransformParameters()

crs_wkt = dataset.GetProjection()
Expand Down

0 comments on commit 593b8c1

Please sign in to comment.