Skip to content

Commit

Permalink
Fix non conflicting error.
Browse files Browse the repository at this point in the history
  • Loading branch information
ismailsunni committed Aug 11, 2016
1 parent 0527cac commit 6a6b375
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions safe/impact_statistics/aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ def __init__(self, extent, aggregation_layer):
# It contains lists of objects that are covered by
# aggregation polygons (one list for one polygon)
self.impact_layer_attributes = []
# Initialize only
self.non_conflicting_agg_attribute = None

# Notes(Ismail): Need to initialize Processing in QGIS 2.8.x
self.processing = Processing
Expand Down Expand Up @@ -911,8 +913,12 @@ def _aggregate_line_impact(self, safe_impact_layer):
setFlags(QgsFeatureRequest.NoGeometry)
# NOTE(IS): I use non conflicting agg attribute to avoid issue with
# the same attribute in exposure layer #2750
agg_attribute_index = impact_layer_splits.dataProvider(). \
fieldNameIndex(self.non_conflicting_agg_attribute)
if self.non_conflicting_agg_attribute:
agg_attribute_index = impact_layer_splits.dataProvider(). \
fieldNameIndex(self.non_conflicting_agg_attribute)
else:
agg_attribute_index = impact_layer_splits.dataProvider(). \
fieldNameIndex(agg_attribute)
for feat in impact_layer_splits.getFeatures(request):
line_attributes = feat.attributes()
polygon_name = line_attributes[agg_attribute_index]
Expand Down

0 comments on commit 6a6b375

Please sign in to comment.