Skip to content
Permalink
Browse files

Use CRS when calculating extent during algorithm extection

  • Loading branch information
nyalldawson committed Sep 14, 2017
1 parent 80a1d71 commit 60b56db904f866806eac1a53d18dc926b64f8a07
@@ -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)

@@ -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()
@@ -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()
@@ -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)

@@ -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))
No changes.
@@ -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

0 comments on commit 60b56db

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