Skip to content

Commit

Permalink
Merge pull request #360 from tilezen/zerebubuth/fix-fixture-name-allo…
Browse files Browse the repository at this point in the history
…cation

Fix fixture name allocation logic
  • Loading branch information
zerebubuth authored Dec 19, 2018
2 parents 60cfadd + 6e63276 commit 6a7c2af
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions tilequeue/query/fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ def __call__(self, zoom, unpadded_bounds):
# whether to clip to a padded box
has_water_layer = False

# tracking which layers claim this feature, as this is important to
# figure out which layer will be assigned the name.
claims_feature_at_some_zoom = set()

for layer_name, info in self.layers.items():
if not info.allows_shape_type(shape):
continue
Expand All @@ -186,6 +190,10 @@ def __call__(self, zoom, unpadded_bounds):
if min_zoom is None:
continue

# make a note that this feature is claimed at some zoom by this
# layer, which is important for name processing.
claims_feature_at_some_zoom.add(layer_name)

# reject anything which isn't in the current zoom range
# note that this is (zoom+1) because things with a min_zoom of
# (e.g) 14.999 should still be in the zoom 14 tile.
Expand Down Expand Up @@ -242,9 +250,15 @@ def __call__(self, zoom, unpadded_bounds):
names[k] = props[k]
if names:
for layer_name in ('pois', 'landuse', 'buildings'):
props_name = '__%s_properties__' % layer_name
if props_name in read_row:
read_row[props_name].update(names)
if layer_name in claims_feature_at_some_zoom:
props_name = '__%s_properties__' % layer_name
if props_name in read_row:
read_row[props_name].update(names)
# break regardless of whether or not we managed to
# update the row - sometimes a feature is claimed
# in one layer at a min_zoom higher than another
# layer's min_zoom. so the feature is visible
# before it gets labelled.
break

read_row['__id__'] = fid
Expand Down

0 comments on commit 6a7c2af

Please sign in to comment.