Skip to content

Commit

Permalink
Merge pull request #273 from tangrams/sensescape/shields-polish
Browse files Browse the repository at this point in the history
bug fix shields polish
  • Loading branch information
nvkelso authored Dec 2, 2018
2 parents 515317c + 8b2b3ad commit b4a423a
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 66 deletions.
5 changes: 4 additions & 1 deletion bubble-wrap-style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2418,6 +2418,8 @@ layers:
visible: false

# this is kinda a hack – generally we don't have artwork sized 6+
# FYI: This happens to "win" in style resolution because it's a-z sorted
# don't rename the layer or it'll fail
width_longggggg:
filter: |
function() {
Expand All @@ -2436,6 +2438,7 @@ layers:
#
# JK: see the theme files for USA and international shields

# FYI: When the USA shields theme is imported it replaces this layer with a richer set of textures
shields-usa:
filter:
all:
Expand All @@ -2446,7 +2449,7 @@ layers:
#texture: mapzen_icon_library_shields_usa
# you need to match any custom shield to the vector tile `network` values
sprite: function() { return (feature.network + '-' + feature.shield_text.length + 'char'); }
sprite_default: function() { return ('generic_shield-' + feature.shield_text.length + 'char'); }
# FYI: sprite_default doesn't support functions, default is carried by parent style's sprite function

# US Interstate roads
US-I:
Expand Down
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

<!-- Main tangram library -->
<!-- production -->
<script src="https://www.nextzen.org/tangram/0.15/tangram.min.js"></script>
<script src="https://www.nextzen.org/tangram/0.16/tangram.min.js"></script>
<!-- production debug -->
<!-- <script src="https://mapzen.com/tangram/0.15/tangram.debug.js"></script> -->
<!-- <script src="https://mapzen.com/tangram/0.16/tangram.debug.js"></script> -->
<!-- dev -->
<!-- <script src="https://precog.mapzen.com/tangrams/tangram/master/dist/tangram.debug.js"></script> -->
<!-- dev branch -->
Expand Down Expand Up @@ -236,7 +236,7 @@
var layer = Tangram.leafletLayer({
scene: { import: [ tg_baseScene,
'themes/bubble-wrap-road-shields-usa.yaml',
'themes/bubble-wrap-road-shields-international.yaml'],
'themes/bubble-wrap-road-shields-international.yaml'],
global: tg_global },
attribution: '<a href="https://github.com/tangrams/tangram" target="_blank">Tangram</a>, &copy; OSM contributors'
});
Expand Down Expand Up @@ -449,7 +449,7 @@
}
update_scene_with_themes();
});

// Enable/disable international road shields
var shields_international = 'International shields';
gui[shields_international] = true;
Expand Down
4 changes: 2 additions & 2 deletions themes/bubble-wrap-road-shields-international.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,7 @@ layers:
texture: mapzen_icon_library_shields_international
# you need to match any custom shield to the vector tile `network` values
sprite: function() { return (feature.network + '-' + feature.shield_text.length + 'char'); }
sprite_default: function() { return ('generic_shield-' + feature.shield_text.length + 'char'); }
# FYI: sprite_default doesn't support functions, default is carried by parent style's sprite function
text:
font:
fill: [0.308,0.308,0.308]
Expand Down Expand Up @@ -1723,7 +1723,7 @@ layers:
text:
font:
fill: white

GR:national:
filter: { network: 'GR:national' }
draw:
Expand Down
96 changes: 50 additions & 46 deletions themes/bubble-wrap-road-shields-usa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ textures:
county_shield-3char: [774, 632, 52, 36]
county_shield-4char: [700, 632, 68, 36]
county_shield-5char: [614, 632, 80, 36]

layers:
roads:
shields:
Expand All @@ -339,7 +339,7 @@ layers:
texture: mapzen_icon_library_shields_usa
# you need to match any custom shield to the vector tile `network` values
sprite: function() { return (feature.network + '-' + feature.shield_text.length + 'char'); }
sprite_default: function() { return ('county_shield-' + feature.shield_text.length + 'char'); }
# FYI: sprite_default doesn't support functions, default is carried by parent style's sprite function

# US Interstate roads
US-I:
Expand Down Expand Up @@ -538,47 +538,51 @@ layers:
offset: [0px, -2px]

# USA County Routes
US-counties:
# Match state highways: `US:??:*`
#
# this is very USA specific
#
# filter: |
# function() {
# return feature.shield_text &&
# /^US:(?!US)\w\w:.*$/.test(feature.network)
# }
#
# this generic for any country with 3rd level networks (like county routes in USA)
# BEWARE:
# US:US:Business about 150
# US:US:Truck
# US:US:Alternate
#
# STATE ROUTE
# ??:??:Loop about 200
# ??:??:Spur about 200
# ??:??:Business about 100
#
# STATE TEXAS SPECIAL ROUTE
# US:TX:FM -- probably just state? there are 3k of these
#
#
filter: |
function() {
return feature.shield_text &&
/^\w+:\w+:(!Alternate).+$/.test(feature.network) &&
$zoom > 10
}
draw:
mapzen_icon_library:
texture: mapzen_icon_library_shields_usa
# you need to match any custom shield to the vector tile `network` values
sprite: function() { return ('county_shield-' + feature.shield_text.length + 'char'); }
#color: pink
#priority: 19
visible: global.sdk_road_shields
text:
font:
fill: [0.508,0.508,0.508]
#size: [[11,7px],[15,10px]]
# This logic can't go in this layer as we only select on exact network matches, not regex
# Someday this should be moved to it's own layer that's at same level as `shields-usa:`
# But since it just replaces now with the default county shield, that's not worth it now
# (really it should have the pentagon pattern)
#US-counties:
# # Match state highways: `US:??:*`
# #
# # this is very USA specific
# #
# # filter: |
# # function() {
# # return feature.shield_text &&
# # /^US:(?!US)\w\w:.*$/.test(feature.network)
# # }
# #
# # this generic for any country with 3rd level networks (like county routes in USA)
# # BEWARE:
# # US:US:Business about 150
# # US:US:Truck
# # US:US:Alternate
##
# # STATE ROUTE
# # ??:??:Loop about 200
# # ??:??:Spur about 200
# # ??:??:Business about 100
##
# # STATE TEXAS SPECIAL ROUTE
# # US:TX:FM -- probably just state? there are 3k of these
# #
# #
# filter: |
# function() {
# return feature.shield_text &&
# /^\w+:\w+:(!Alternate).+$/.test(feature.network) &&
# $zoom > 10
# }
# draw:
# mapzen_icon_library:
# texture: mapzen_icon_library_shields_usa
# # you need to match any custom shield to the vector tile `network` values
# sprite: function() { return ('county_shield-' + feature.shield_text.length + 'char'); }
# #color: pink
# #priority: 19
# visible: global.sdk_road_shields
# text:
# font:
# fill: [0.508,0.508,0.508]
# #size: [[11,7px],[15,10px]]
Binary file modified themes/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified themes/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified themes/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 14 additions & 13 deletions themes/label-7.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,17 @@ layers:

buildings:
buildings-labels:
all:
- { $zoom: { min: 17 } }
- $geometry: point
- function() { return global.text_visible_building; }
- landuse_kind: [university, college, school, kindergarten]
any:
- { $zoom: [17], area: { min: 3000 }, name: true }
- { $zoom: [17], area: { min: 2000 }, kind_detail: [university, college, school, kindergarten] }
- { $zoom: [18], area: { min: 1000 }, name: true }
- { $zoom: [18], kind_detail: [university, college, school, kindergarten] }
- { $zoom: [19], area: { min: 200 }, name: true }
- { $zoom: { min: 19 }, kind_detail: [university, college, school, kindergarten] }
- { $zoom: { min: 20 }, name: true }
filter:
all:
- { $zoom: { min: 17 } }
- $geometry: point
- function() { return global.text_visible_building; }
- landuse_kind: [university, college, school, kindergarten]
any:
- { $zoom: [17], area: { min: 3000 }, name: true }
- { $zoom: [17], area: { min: 2000 }, kind_detail: [university, college, school, kindergarten] }
- { $zoom: [18], area: { min: 1000 }, name: true }
- { $zoom: [18], kind_detail: [university, college, school, kindergarten] }
- { $zoom: [19], area: { min: 200 }, name: true }
- { $zoom: { min: 19 }, kind_detail: [university, college, school, kindergarten] }
- { $zoom: { min: 20 }, name: true }

0 comments on commit b4a423a

Please sign in to comment.