Skip to content

Commit

Permalink
Merge pull request #148 from mapzen/524-peak-tile-kind-rank
Browse files Browse the repository at this point in the history
Add sort order for peaks
  • Loading branch information
zerebubuth committed Apr 28, 2016
2 parents 49a17c0 + 2881e4a commit 8ce9e19
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions TileStache/Goodies/VecTiles/sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,17 @@ def _by_transit_score(feature):
return props.get('mz_transit_score', 0)


def _sort_by_transit_score_then_feature_id(features):
def _by_peak_elevation(feature):
wkb, props, fid = feature
kind = props.get('kind')
if kind != 'peak' and kind != 'volcano':
return 0
return props.get('elevation', 0)


def _sort_by_transit_score_then_elevation_then_feature_id(features):
features.sort(key=_by_feature_id)
features.sort(key=_by_peak_elevation, reverse=True)
features.sort(key=_by_transit_score, reverse=True)
return features

Expand Down Expand Up @@ -83,7 +92,7 @@ def places(features, zoom):


def pois(features, zoom):
return _sort_by_transit_score_then_feature_id(features)
return _sort_by_transit_score_then_elevation_then_feature_id(features)


def roads(features, zoom):
Expand Down

0 comments on commit 8ce9e19

Please sign in to comment.