From 42bf243fedf039a887a6b8b9cc983c1faa7df0af Mon Sep 17 00:00:00 2001 From: Matt Amos Date: Thu, 28 Apr 2016 12:54:18 +0100 Subject: [PATCH 1/2] Sort POIs by elevation when they are peaks. --- TileStache/Goodies/VecTiles/sort.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/TileStache/Goodies/VecTiles/sort.py b/TileStache/Goodies/VecTiles/sort.py index 3a65d138..66f75cb3 100644 --- a/TileStache/Goodies/VecTiles/sort.py +++ b/TileStache/Goodies/VecTiles/sort.py @@ -51,8 +51,16 @@ 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 + if props.get('kind') != 'peak': + 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 @@ -83,7 +91,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): From 2881e4a6080828604e7c34cbb419b2ebec097c92 Mon Sep 17 00:00:00 2001 From: Matt Amos Date: Thu, 28 Apr 2016 14:36:49 +0100 Subject: [PATCH 2/2] Extend peaks to include volcanos. --- TileStache/Goodies/VecTiles/sort.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TileStache/Goodies/VecTiles/sort.py b/TileStache/Goodies/VecTiles/sort.py index 66f75cb3..62fd21fe 100644 --- a/TileStache/Goodies/VecTiles/sort.py +++ b/TileStache/Goodies/VecTiles/sort.py @@ -53,7 +53,8 @@ def _by_transit_score(feature): def _by_peak_elevation(feature): wkb, props, fid = feature - if props.get('kind') != 'peak': + kind = props.get('kind') + if kind != 'peak' and kind != 'volcano': return 0 return props.get('elevation', 0)