Skip to content

Commit

Permalink
Merge pull request #142 from mapzen/remove-unused-road-sort_key-trans…
Browse files Browse the repository at this point in the history
…form

Remove the unused road_sort_key transform
  • Loading branch information
rmarianski committed Apr 12, 2016
2 parents 20e7669 + 9e15acc commit 2c88ac8
Showing 1 changed file with 0 additions and 85 deletions.
85 changes: 0 additions & 85 deletions TileStache/Goodies/VecTiles/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,91 +280,6 @@ def road_classifier(shape, properties, fid, zoom):
return shape, properties, fid


def road_sort_key(shape, properties, fid, zoom):
# Note! parse_layer_as_float must be run before this filter.

floor = 300
ceiling = 447
sort_val = floor

highway = properties.get('highway', '')
railway = properties.get('railway', '')
aeroway = properties.get('aeroway', '')
aerialway = properties.get('aerialway', '')
service = properties.get('service', '')
ne_type = properties.get('type', '')

is_railway = railway in (
'rail', 'tram', 'light_rail', 'narrow_gauge', 'monorail')

if (highway == 'motorway' or
ne_type in ('Major Highway', 'Beltway', 'Bypass')):
sort_val += 81
elif is_railway:
sort_val += 80
elif highway == 'trunk' or ne_type == 'Secondary Highway':
sort_val += 79
elif highway == 'primary' or ne_type == 'Road':
sort_val += 78
elif highway == 'secondary' or aeroway == 'runway':
sort_val += 77
elif highway == 'tertiary' or aeroway == 'taxiway' or ne_type == 'Track':
sort_val += 76
elif highway.endswith('_link'):
sort_val += 75
elif (highway in ('residential', 'unclassified', 'road', 'living_street')
or ne_type == 'Unknown'):
sort_val += 60
elif highway in ('service'):
sort_val += 58
elif aerialway in ('gondola', 'cable_car'):
sort_val += 92
elif aerialway == 'chair_lift':
sort_val += 91
elif aerialway:
sort_val += 90
else:
sort_val += 55

if is_railway and service:
if service in ('spur', 'siding'):
# make sort val more like residential, unclassified which
# also come in at zoom 12
sort_val -= 19
elif service == 'yard':
sort_val -= 21
else:
sort_val -= 23

if highway == 'service' and service:
# sort alley, driveway, etc... under service
sort_val -= 2

if zoom >= 15:
bridge = properties.get('bridge')
tunnel = properties.get('tunnel')
if bridge in ('yes', 'true') or aerialway:
sort_val += 50
elif (tunnel in ('yes', 'true') or
(railway == 'subway' and tunnel not in ('no', 'false'))):
sort_val -= 50

# Explicit layer is clipped to [-5, 5] range. Note that
# the layer, if present, will be a Float due to the
# parse_layer_as_float filter.
layer = properties.get('layer')
if layer is not None:
layer = max(min(layer, 5), -5)
if layer > 0:
sort_val = int(layer + ceiling - 5)
elif layer < 0:
sort_val = int(layer + floor + 5)

properties['sort_key'] = sort_val

return shape, properties, fid


def road_trim_properties(shape, properties, fid, zoom):
properties = _remove_properties(properties, 'bridge', 'tunnel')
return shape, properties, fid
Expand Down

0 comments on commit 2c88ac8

Please sign in to comment.