Navigation Menu

Skip to content

Commit

Permalink
Use CRS when calculating extent during algorithm extection
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 14, 2017
1 parent 80a1d71 commit 60b56db
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 7 deletions.
Expand Up @@ -76,8 +76,8 @@ def displayName(self):
return self.tr('Create constant raster layer')

def processAlgorithm(self, parameters, context, feedback):
extent = self.parameterAsExtent(parameters, self.EXTENT, context)
crs = self.parameterAsCrs(parameters, self.TARGET_CRS, context)
extent = self.parameterAsExtent(parameters, self.EXTENT, context, crs)
value = self.parameterAsDouble(parameters, self.NUMBER, context)
pixelSize = self.parameterAsDouble(parameters, self.PIXEL_SIZE, context)

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/GridLine.py
Expand Up @@ -105,8 +105,8 @@ def processAlgorithm(self, parameters, context, feedback):
hOverlay = self.parameterAsDouble(parameters, self.HOVERLAY, context)
vOverlay = self.parameterAsDouble(parameters, self.VOVERLAY, context)

bbox = self.parameterAsExtent(parameters, self.EXTENT, context)
crs = self.parameterAsCrs(parameters, self.CRS, context)
bbox = self.parameterAsExtent(parameters, self.EXTENT, context, crs)

width = bbox.width()
height = bbox.height()
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/GridPolygon.py
Expand Up @@ -113,8 +113,8 @@ def processAlgorithm(self, parameters, context, feedback):
hOverlay = self.parameterAsDouble(parameters, self.HOVERLAY, context)
vOverlay = self.parameterAsDouble(parameters, self.VOVERLAY, context)

bbox = self.parameterAsExtent(parameters, self.EXTENT, context)
crs = self.parameterAsCrs(parameters, self.CRS, context)
bbox = self.parameterAsExtent(parameters, self.EXTENT, context, crs)

width = bbox.width()
height = bbox.height()
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/RandomPointsExtent.py
Expand Up @@ -94,10 +94,10 @@ def displayName(self):
return self.tr('Random points in extent')

def processAlgorithm(self, parameters, context, feedback):
bbox = self.parameterAsExtent(parameters, self.EXTENT, context)
pointCount = self.parameterAsDouble(parameters, self.POINTS_NUMBER, context)
minDistance = self.parameterAsDouble(parameters, self.MIN_DISTANCE, context)
crs = self.parameterAsCrs(parameters, self.TARGET_CRS, context)
bbox = self.parameterAsExtent(parameters, self.EXTENT, context, crs)

extent = QgsGeometry().fromRect(bbox)

Expand Down
3 changes: 1 addition & 2 deletions python/plugins/processing/algs/qgis/RegularPoints.py
Expand Up @@ -93,13 +93,12 @@ def displayName(self):
return self.tr('Regular points')

def processAlgorithm(self, parameters, context, feedback):
extent = self.parameterAsExtent(parameters, self.EXTENT, context)

spacing = self.parameterAsDouble(parameters, self.SPACING, context)
inset = self.parameterAsDouble(parameters, self.INSET, context)
randomize = self.parameterAsBool(parameters, self.RANDOMIZE, context)
isSpacing = self.parameterAsBool(parameters, self.IS_SPACING, context)
crs = self.parameterAsCrs(parameters, self.CRS, context)
extent = self.parameterAsExtent(parameters, self.EXTENT, context, crs)

fields = QgsFields()
fields.append(QgsField('id', QVariant.Int, '', 10, 0))
Expand Down
Empty file modified python/plugins/processing/gui/ExtentSelectionPanel.py 100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion src/core/processing/qgsnativealgorithms.cpp
Expand Up @@ -1842,7 +1842,7 @@ QVariantMap QgsExtractByExtentAlgorithm::processAlgorithm( const QVariantMap &pa
if ( !featureSource )
return QVariantMap();

QgsRectangle extent = parameterAsExtent( parameters, QStringLiteral( "EXTENT" ), context );
QgsRectangle extent = parameterAsExtent( parameters, QStringLiteral( "EXTENT" ), context, featureSource->sourceCrs() );
bool clip = parameterAsBool( parameters, QStringLiteral( "CLIP" ), context );

// if clipping, we force multi output
Expand Down

0 comments on commit 60b56db

Please sign in to comment.