Skip to content

Commit

Permalink
Merge pull request #35 from austromorph/windows-3.1.2
Browse files Browse the repository at this point in the history
fixes for windows, tested on osx (proper child-algorithm handling)
  • Loading branch information
christophfink authored Jan 14, 2022
2 parents 2cb8031 + 7452716 commit 6a0f516
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions lib/cartogramprocessingalgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,16 @@ def processAlgorithm(self, parameters, context, feedback):
# first, copy all features to a temporary layer
# we use a zero-width buffer algorithm to do this,
# in order to fix potential invalid geometries at the same time
memory_layer = processing.run(
"native:buffer", {
"INPUT": input_layer,
"DISTANCE": 0.0,
"OUTPUT": "memory:"
},
context=context,
feedback=feedback
memory_layer = context.getMapLayer(
processing.run(
"native:buffer", {
"INPUT": parameters[self.INPUT],
"DISTANCE": 0.0,
"OUTPUT": "memory:"
},
context=context,
is_child_algorithm=True
)["OUTPUT"]
)

cartogram_features = CartogramFeatures.from_polygon_layer(memory_layer, field_name, feedback)
Expand All @@ -162,15 +164,17 @@ def processAlgorithm(self, parameters, context, feedback):

# We are sometimes left with slithers and polygons misshaped in other ways,
# a zero-buffer around them works well
buffered_layer = processing.run(
"native:buffer", {
"INPUT": memory_layer,
"DISTANCE": 0.0,
"OUTPUT": "memory:"
},
context=context,
feedback=feedback
)["OUTPUT"]
buffered_layer = context.getMapLayer(
processing.run(
"native:buffer", {
"INPUT": memory_layer,
"DISTANCE": 0.0,
"OUTPUT": "memory:"
},
context=context,
is_child_algorithm=True
)["OUTPUT"]
)

# finally, copy features to the output sink
for feature in buffered_layer.getFeatures():
Expand Down

0 comments on commit 6a0f516

Please sign in to comment.