Skip to content

Commit

Permalink
V.tile-ify: Make way_pixels work
Browse files Browse the repository at this point in the history
way_pixels is used for deciding whether an object should be shown. It
adapts to the zoom level. However it's calculated in data, so for the
z14 vectortiles, the way_pixels size is fixed at the z14 size.

This means some style rules won't be applied for z14+ tiles.

Solution is to manually add in some new way_pixel filters based on the
z14 filter, and taking into account the fact that one pixel in Z is 4
pixels in Z+1.
  • Loading branch information
Rory McCann committed Jun 28, 2016
1 parent f76e913 commit fb863ad
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 138 deletions.
1 change: 1 addition & 0 deletions addressing.mss
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#building-text {
[zoom >= 14][way_pixels > 3000],
[zoom=15][way_pixels > 750], [zoom=16][way_pixels > 187],
[zoom >= 17] {
text-name: "[name]";
text-size: 11;
Expand Down
6 changes: 4 additions & 2 deletions admin.mss
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ overlapping borders correctly.
}

#nature-reserve-text {
[zoom >= 13][way_pixels > 192000] {
[zoom >= 13][way_pixels > 192000],
[zoom=14][way_pixels > 192000], [zoom=15][way_pixels > 48000], [zoom=16][way_pixels > 12000], [zoom=17][way_pixels > 3000], [zoom=18][way_pixels > 750], [zoom>=19][way_pixels > 187] {
text-name: "[name]";
text-face-name: @book-fonts;
text-fill: green;
Expand All @@ -192,7 +193,8 @@ overlapping borders correctly.
}

#nature-reserve-boundaries {
[way_pixels > 100][zoom >= 7] {
[way_pixels > 100][zoom >= 7],
[zoom=14][way_pixels > 100], [zoom=15][way_pixels > 25], [zoom=16][way_pixels > 6], [zoom>=17][way_pixels > 1] {
[zoom < 10] {
::fill {
opacity: 0.05;
Expand Down
73 changes: 42 additions & 31 deletions amenity-points.mss
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
[feature = 'amenity_parking'],
[feature = 'amenity_bicycle_parking'],
[feature = 'amenity_motorcycle_parking'] {
[way_pixels > 900] {
[zoom<14][way_pixels > 900], [zoom=14][way_pixels > 900], [zoom=15][way_pixels > 225], [zoom=16][way_pixels > 56], [zoom=17][way_pixels > 14], [zoom=18][way_pixels > 3], [zoom>=19] {
[feature = 'amenity_parking'] {
marker-file: url('symbols/parking.svg');
}
Expand Down Expand Up @@ -1132,8 +1132,8 @@
text-name: "[name]";
text-fill: #000;
text-size: @standard-text-size;
[way_pixels > 12000] { text-size: 12; }
[way_pixels > 48000] { text-size: 15; }
[way_pixels > 12000], [zoom=14][way_pixels > 12000], [zoom=15][way_pixels > 3000], [zoom=16][way_pixels > 750], [zoom=17][way_pixels > 187], [zoom=18][way_pixels > 46], [zoom>=19][way_pixels > 11] { text-size: 12; }
[way_pixels > 48000], [zoom=14][way_pixels > 48000], [zoom=15][way_pixels > 12000], [zoom=16][way_pixels > 3000], [zoom=17][way_pixels > 750], [zoom=18][way_pixels > 187], [zoom>=19][way_pixels > 46] { text-size: 15; }
text-face-name: @oblique-fonts;
text-halo-radius: 1;
text-halo-fill: rgba(255,255,255,0.6);
Expand Down Expand Up @@ -1215,7 +1215,7 @@
[feature = 'amenity_bicycle_parking'],
[feature = 'amenity_motorcycle_parking']
{
[zoom >= 10][way_pixels > 900] {
[zoom >= 10][way_pixels > 900], [zoom=14][way_pixels > 900], [zoom=15][way_pixels > 225], [zoom=16][way_pixels > 56], [zoom=17][way_pixels > 14], [zoom=18][way_pixels > 3], [zoom>=19] {
text-name: "[name]";
text-size: @standard-text-size;
text-fill: @transportation-text;
Expand Down Expand Up @@ -1357,16 +1357,15 @@
}

[feature = 'leisure_swimming_pool'][is_building = 'no'] {
[zoom >= 14][way_pixels > 3000],
[zoom >= 17] {
[zoom=14][way_pixels > 3000], [zoom=15][way_pixels > 750], [zoom=16][way_pixels > 187], [zoom>=17] {
text-name: "[name]";
text-size: @landcover-font-size;
text-wrap-width: @landcover-wrap-width-size;
[way_pixels > 12000] {
[way_pixels > 12000], [zoom=14][way_pixels > 12000], [zoom=15][way_pixels > 3000], [zoom=16][way_pixels > 750], [zoom=17][way_pixels > 187], [zoom=18][way_pixels > 46], [zoom>=19][way_pixels > 11] {
text-size: @landcover-font-size-big;
text-wrap-width: @landcover-wrap-width-size-big;
}
[way_pixels > 48000] {
[way_pixels > 48000], [zoom=14][way_pixels > 48000], [zoom=15][way_pixels > 12000], [zoom=16][way_pixels > 3000], [zoom=17][way_pixels > 750], [zoom=18][way_pixels > 187], [zoom>=19][way_pixels > 46] {
text-size: @landcover-font-size-bigger;
text-wrap-width: @landcover-wrap-width-size-bigger;
}
Expand Down Expand Up @@ -1404,15 +1403,15 @@
[feature = 'boundary_national_park'],
[feature = 'leisure_nature_reserve'] {
[zoom >= 8][way_pixels > 3000][is_building = 'no'],
[zoom >= 17] {
[zoom >= 17] {
text-name: "[name]";
text-size: @landcover-font-size;
text-wrap-width: @landcover-wrap-width-size;
[way_pixels > 12000] {
[way_pixels > 12000], [zoom=14][way_pixels > 12000], [zoom=15][way_pixels > 3000], [zoom=16][way_pixels > 750], [zoom=17][way_pixels > 187], [zoom=18][way_pixels > 46], [zoom>=19][way_pixels > 11] {
text-size: @landcover-font-size-big;
text-wrap-width: @landcover-wrap-width-size-big;
}
[way_pixels > 48000] {
[way_pixels > 48000], [zoom=14][way_pixels > 48000], [zoom=15][way_pixels > 12000], [zoom=16][way_pixels > 3000], [zoom=17][way_pixels > 750], [zoom=18][way_pixels > 187], [zoom>=19][way_pixels > 46] {
text-size: @landcover-font-size-bigger;
text-wrap-width: @landcover-wrap-width-size-bigger;
}
Expand All @@ -1436,15 +1435,16 @@

[feature = 'military_danger_area'][is_building = 'no'] {
[zoom >= 9][way_pixels > 3000],
[zoom=14][way_pixels > 3000], [zoom=15][way_pixels > 750], [zoom=16][way_pixels > 187],
[zoom >= 17] {
text-name: "[name]";
text-size: @landcover-font-size;
text-wrap-width: @landcover-wrap-width-size;
[way_pixels > 12000] {
[way_pixels > 12000], [zoom=14][way_pixels > 12000], [zoom=15][way_pixels > 3000], [zoom=16][way_pixels > 750], [zoom=17][way_pixels > 187], [zoom=18][way_pixels > 46], [zoom>=19][way_pixels > 11] {
text-size: @landcover-font-size-big;
text-wrap-width: @landcover-wrap-width-size-big;
}
[way_pixels > 48000] {
[way_pixels > 48000], [zoom=14][way_pixels > 48000], [zoom=15][way_pixels > 12000], [zoom=16][way_pixels > 3000], [zoom=17][way_pixels > 750], [zoom=18][way_pixels > 187], [zoom>=19][way_pixels > 46] {
text-size: @landcover-font-size-bigger;
text-wrap-width: @landcover-wrap-width-size-bigger;
}
Expand All @@ -1458,15 +1458,16 @@

[feature = 'landuse_garages'][is_building = 'no'] {
[zoom >= 13][way_pixels > 3000],
[zoom=14][way_pixels > 3000], [zoom=15][way_pixels > 750], [zoom=16][way_pixels > 187],
[zoom >= 17] {
text-name: "[name]";
text-size: @landcover-font-size;
text-wrap-width: @landcover-wrap-width-size;
[way_pixels > 12000] {
[way_pixels > 12000], [zoom=14][way_pixels > 12000], [zoom=15][way_pixels > 3000], [zoom=16][way_pixels > 750], [zoom=17][way_pixels > 187], [zoom=18][way_pixels > 46], [zoom>=19][way_pixels > 11] {
text-size: @landcover-font-size-big;
text-wrap-width: @landcover-wrap-width-size-big;
}
[way_pixels > 48000] {
[way_pixels > 48000], [zoom=14][way_pixels > 48000], [zoom=15][way_pixels > 12000], [zoom=16][way_pixels > 3000], [zoom=17][way_pixels > 750], [zoom=18][way_pixels > 187], [zoom>=19][way_pixels > 46] {
text-size: @landcover-font-size-bigger;
text-wrap-width: @landcover-wrap-width-size-bigger;
}
Expand Down Expand Up @@ -1526,18 +1527,22 @@
[feature = 'leisure_stadium'],
[feature = 'leisure_track'],
[feature = 'leisure_pitch'] {
[zoom >= 10][way_pixels > 3000][is_building = 'no'],
[zoom >= 10][way_pixels > 3000][is_building = 'no'], [is_building = 'no'][zoom=14][way_pixels > 3000], [is_building = 'no'][zoom=15][way_pixels > 750], [is_building = 'no'][zoom=16][way_pixels > 187],
[zoom >= 17][is_building = 'no'],
[zoom >= 10][way_pixels > 3000][feature = 'shop_mall'],
[zoom >= 10][way_pixels > 3000][feature = 'shop_mall'], [feature = 'shop_mall'][zoom=14][way_pixels > 3000], [feature = 'shop_mall'][zoom=15][way_pixels > 750], [feature = 'shop_mall'][zoom=16][way_pixels > 187],
[zoom >= 17][feature = 'shop_mall'] {
text-name: "[name]";
text-size: @landcover-font-size;
text-wrap-width: @landcover-wrap-width-size;
[way_pixels > 12000] {
[way_pixels > 12000],
[zoom=14][way_pixels > 12000], [zoom=15][way_pixels > 3000], [zoom=16][way_pixels > 750], [zoom=17][way_pixels > 187], [zoom=18][way_pixels > 46], [zoom>=19][way_pixels > 11]
{
text-size: @landcover-font-size-big;
text-wrap-width: @landcover-wrap-width-size-big;
}
[way_pixels > 48000] {
[way_pixels > 48000],
[zoom=14][way_pixels > 48000], [zoom=15][way_pixels > 12000], [zoom=16][way_pixels > 3000], [zoom=17][way_pixels > 750], [zoom=18][way_pixels > 187], [zoom>=19][way_pixels > 46]
{
text-size: @landcover-font-size-bigger;
text-wrap-width: @landcover-wrap-width-size-bigger;
}
Expand Down Expand Up @@ -1750,15 +1755,16 @@

[feature = 'leisure_marina'][zoom >= 15] {
[zoom >= 10][way_pixels > 3000],
[zoom=14][way_pixels > 3000], [zoom=15][way_pixels > 750], [zoom=16][way_pixels > 187],
[zoom >= 17] {
text-name: "[name]";
text-size: @landcover-font-size;
text-wrap-width: @landcover-wrap-width-size;
[way_pixels > 12000] {
[way_pixels > 12000], [zoom=14][way_pixels > 12000], [zoom=15][way_pixels > 3000], [zoom=16][way_pixels > 750], [zoom=17][way_pixels > 187], [zoom=18][way_pixels > 46], [zoom>=19][way_pixels > 11] {
text-size: @landcover-font-size-big;
text-wrap-width: @landcover-wrap-width-size-big;
}
[way_pixels > 48000] {
[way_pixels > 48000], [zoom=14][way_pixels > 48000], [zoom=15][way_pixels > 12000], [zoom=16][way_pixels > 3000], [zoom=17][way_pixels > 750], [zoom=18][way_pixels > 187], [zoom>=19][way_pixels > 46] {
text-size: @landcover-font-size-bigger;
text-wrap-width: @landcover-wrap-width-size-bigger;
}
Expand Down Expand Up @@ -1961,15 +1967,16 @@
[feature = 'power_sub_station'][is_building = 'no'][zoom >= 13],
[feature = 'power_substation'][is_building = 'no'][zoom >= 13]{
[way_pixels > 3000],
[zoom=14][way_pixels > 3000], [zoom=15][way_pixels > 750], [zoom=16][way_pixels > 187]
[zoom >= 17] {
text-name: "[name]";
text-size: @landcover-font-size;
text-wrap-width: @landcover-wrap-width-size;
[way_pixels > 12000] {
[way_pixels > 12000], [zoom=14][way_pixels > 12000], [zoom=15][way_pixels > 3000], [zoom=16][way_pixels > 750], [zoom=17][way_pixels > 187], [zoom=18][way_pixels > 46], [zoom>=19][way_pixels > 11] {
text-size: @landcover-font-size-big;
text-wrap-width: @landcover-wrap-width-size-big;
}
[way_pixels > 48000] {
[way_pixels > 48000], [zoom=14][way_pixels > 48000], [zoom=15][way_pixels > 12000], [zoom=16][way_pixels > 3000], [zoom=17][way_pixels > 750], [zoom=18][way_pixels > 187], [zoom>=19][way_pixels > 46] {
text-size: @landcover-font-size-bigger;
text-wrap-width: @landcover-wrap-width-size-bigger;
}
Expand All @@ -1986,15 +1993,16 @@
[feature = 'natural_bare_rock'],
[feature = 'natural_sand'] {
[zoom >= 9][way_pixels > 3000][is_building = 'no'],
[zoom=14][way_pixels > 3000][is_building = 'no'], [zoom=15][way_pixels > 750][is_building = 'no'], [zoom=16][way_pixels > 187][is_building = 'no'],
[zoom >= 17][is_building = 'no'] {
text-name: "[name]";
text-size: @landcover-font-size;
text-wrap-width: @landcover-wrap-width-size;
[way_pixels > 12000] {
[way_pixels > 12000], [zoom=14][way_pixels > 12000], [zoom=15][way_pixels > 3000], [zoom=16][way_pixels > 750], [zoom=17][way_pixels > 187], [zoom=18][way_pixels > 46], [zoom>=19][way_pixels > 11] {
text-size: @landcover-font-size-big;
text-wrap-width: @landcover-wrap-width-size-big;
}
[way_pixels > 48000] {
[way_pixels > 48000], [zoom=14][way_pixels > 48000], [zoom=15][way_pixels > 12000], [zoom=16][way_pixels > 3000], [zoom=17][way_pixels > 750], [zoom=18][way_pixels > 187], [zoom>=19][way_pixels > 46] {
text-size: @landcover-font-size-bigger;
text-wrap-width: @landcover-wrap-width-size-bigger;
}
Expand All @@ -2015,15 +2023,16 @@

[feature = 'aeroway_apron'][is_building = 'no'] {
[zoom >= 10][way_pixels > 3000],
[zoom=14][way_pixels > 3000], [zoom=15][way_pixels > 750], [zoom=16][way_pixels > 187],
[zoom >= 17] {
text-name: "[name]";
text-size: @landcover-font-size;
text-wrap-width: @landcover-wrap-width-size;
[way_pixels > 12000] {
[way_pixels > 12000], [zoom=14][way_pixels > 12000], [zoom=15][way_pixels > 3000], [zoom=16][way_pixels > 750], [zoom=17][way_pixels > 187], [zoom=18][way_pixels > 46], [zoom>=19][way_pixels > 11] {
text-size: @landcover-font-size-big;
text-wrap-width: @landcover-wrap-width-size-big;
}
[way_pixels > 48000] {
[way_pixels > 48000], [zoom=14][way_pixels > 48000], [zoom=15][way_pixels > 12000], [zoom=16][way_pixels > 3000], [zoom=17][way_pixels > 750], [zoom=18][way_pixels > 187], [zoom>=19][way_pixels > 46] {
text-size: @landcover-font-size-bigger;
text-wrap-width: @landcover-wrap-width-size-bigger;
}
Expand All @@ -2038,15 +2047,16 @@
[feature = 'highway_services'][is_building = 'no'],
[feature = 'highway_rest_area'][is_building = 'no'] {
[zoom >= 10][way_pixels > 3000],
[zoom=14][way_pixels > 3000], [zoom=15][way_pixels > 750], [zoom=16][way_pixels > 187],
[zoom >= 17] {
text-name: "[name]";
text-size: @landcover-font-size;
text-wrap-width: @landcover-wrap-width-size;
[way_pixels > 12000] {
[way_pixels > 12000], [zoom=14][way_pixels > 12000], [zoom=15][way_pixels > 3000], [zoom=16][way_pixels > 750], [zoom=17][way_pixels > 187], [zoom=18][way_pixels > 46], [zoom>=19][way_pixels > 11] {
text-size: @landcover-font-size-big;
text-wrap-width: @landcover-wrap-width-size-big;
}
[way_pixels > 48000] {
[way_pixels > 48000], [zoom=14][way_pixels > 48000], [zoom=15][way_pixels > 12000], [zoom=16][way_pixels > 3000], [zoom=17][way_pixels > 750], [zoom=18][way_pixels > 187], [zoom>=19][way_pixels > 46] {
text-size: @landcover-font-size-bigger;
text-wrap-width: @landcover-wrap-width-size-bigger;
}
Expand All @@ -2061,15 +2071,16 @@
[feature = 'natural_glacier'][is_building = 'no'] {
[zoom >= 8][way_pixels > 10000],
[zoom >= 10][way_pixels > 750],
[zoom=14][way_pixels > 750], [zoom=15][way_pixels > 187], [zoom=16][way_pixels > 46],
[zoom >= 17] {
text-name: "[name]";
text-size: @landcover-font-size;
text-wrap-width: @landcover-wrap-width-size;
[way_pixels > 12000] {
[way_pixels > 12000], [zoom=14][way_pixels > 12000], [zoom=15][way_pixels > 3000], [zoom=16][way_pixels > 750], [zoom=17][way_pixels > 187], [zoom=18][way_pixels > 46], [zoom>=19][way_pixels > 11] {
text-size: @landcover-font-size-big;
text-wrap-width: @landcover-wrap-width-size-big;
}
[way_pixels > 48000] {
[way_pixels > 48000], [zoom=14][way_pixels > 48000], [zoom=15][way_pixels > 12000], [zoom=16][way_pixels > 3000], [zoom=17][way_pixels > 750], [zoom=18][way_pixels > 187], [zoom>=19][way_pixels > 46] {
text-size: @landcover-font-size-bigger;
text-wrap-width: @landcover-wrap-width-size-bigger;
}
Expand Down
Loading

0 comments on commit fb863ad

Please sign in to comment.