Skip to content

Commit

Permalink
rework admin boundaries and admin labels on lower zooms, render count…
Browse files Browse the repository at this point in the history
…ry subdivisions only for the biggest countries on z4
  • Loading branch information
nebulon42 committed Oct 31, 2015
1 parent bba14e0 commit 4850965
Show file tree
Hide file tree
Showing 5 changed files with 276 additions and 33 deletions.
68 changes: 51 additions & 17 deletions admin.mss
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,82 @@ For each zoomlevel, all borders come from a single attachment, to handle
overlapping borders correctly.
*/

#admin-low-zoom[zoom < 11],
#admin-very-low-zoom[zoom >= 4][zoom < 5],
#admin-low-zoom[zoom >= 5][zoom < 11],
#admin-mid-zoom[zoom >= 11][zoom < 13],
#admin-high-zoom[zoom >= 13] {
[admin_level = '2'],
[admin_level = '3'] {
[admin_level = '2'] {
[zoom >= 4] {
background/line-color: white;
background/line-width: 0.6;
background/line-width: 1.2;
line-color: @admin-boundaries;
line-width: 0.6;
line-width: 1.2;
}
[zoom >= 5] {
background/line-width: 1.5;
line-width: 1.5;
}
[zoom >= 6] {
background/line-width: 1.8;
line-width: 1.8;
}
[zoom >= 7] {
background/line-width: 2;
line-width: 2;
}
[zoom >= 10] {
[admin_level = '2'] {
background/line-width: 6;
line-width: 6;
}
[admin_level = '3'] {
background/line-width: 5;
line-width: 5;
line-dasharray: 4,2;
line-clip: false;
}
background/line-width: 6;
line-width: 6;
}
}
[admin_level = '4'] {
[admin_level = '3'] {
[zoom >= 4] {
background/line-color: white;
background/line-width: 0.6;
line-color: @admin-boundaries;
line-width: 0.6;
}
[zoom >= 7] {
background/line-width: 1.2;
line-width: 1.2;
}
[zoom >= 10] {
background/line-width: 4;
line-width: 4;
line-dasharray: 4,2;
line-clip: false;
}
}
[admin_level = '4'] {
[zoom >= 4] {
background/line-color: white;
background/line-width: 0.4;
line-color: @admin-boundaries;
line-width: 0.4;
line-dasharray: 4,3;
line-clip: false;
}
[zoom >= 5] {
background/line-width: 0.6;
line-width: 0.6;
}
[zoom >= 6] {
background/line-width: 0.8;
line-width: 0.8;
}
[zoom >= 7] {
background/line-width: 1;
line-width: 1;
}
[zoom >= 11] {
[zoom >= 9] {
background/line-width: 1.8;
line-width: 1.8;
}
[zoom >= 10] {
background/line-width: 2.5;
line-width: 2.5;
}
[zoom >= 12] {
background/line-width: 3;
line-width: 3;
}
Expand Down
41 changes: 31 additions & 10 deletions placenames.mss
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
@placenames: #222;
@placenames-light: #777777;
@country-labels: darken(@admin-boundaries, 15%);
@state-labels: desaturate(darken(@admin-boundaries, 5%), 20%);

.country {
[admin_level = '2'][zoom >= 2][way_pixels > 3000][way_pixels < 196000] {
[admin_level = '2'][zoom >= 3][way_pixels > 1000][way_pixels < 360000] {
text-name: "[name]";
text-size: 9;
text-fill: #9d6c9d;

[zoom >= 3] {
text-size: 10;
}
[zoom >= 4] {
text-size: 11;
}
[zoom >= 5] {
text-size: 12;
}
[zoom >= 7] {
text-size: 13;
}
[zoom >= 10] {
text-size: 14;
}

text-fill: @country-labels;
text-face-name: @book-fonts;
text-halo-fill: rgba(255,255,255,0.6);
text-halo-radius: 1.5;
text-wrap-width: 50;
text-wrap-width: 35;
text-placement: interior;
[zoom >= 4] {
text-size: 10;
}
text-character-spacing: 0.5;
text-min-distance: 3;
text-line-spacing: 1;
}
}

Expand All @@ -22,26 +42,27 @@
[zoom >= 5][way_pixels > 3000][way_pixels < 196000] {
text-name: "[ref]";
text-size: 9;
text-fill: #9d6c9d;
text-fill: @state-labels;
text-face-name: @oblique-fonts;
text-halo-fill: rgba(255,255,255,0.6);
text-halo-radius: 1.5;
text-wrap-width: 0;
text-placement: interior;
text-min-distance: 3;
[zoom >= 5] {
text-name: "[name]";
text-wrap-width: 50;
text-wrap-width: 30;
}
[zoom >= 7] {
text-size: 11;
text-wrap-width: 70;
text-wrap-width: 50;
}
}
}
}

#placenames-medium::high-importance {
[category = 1][zoom < 14] {
[zoom >= 3][score >= 5000000],
[zoom >= 4][score >= 3000000],
[zoom >= 5][score >= 400000] {
text-name: "[name]";
Expand Down
88 changes: 85 additions & 3 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,33 @@
},
"advanced": {}
},
{
"name": "admin-very-low-zoom",
"srs-name": "900913",
"geometry": "linestring",
"class": "",
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
"Datasource": {
"extent": "-20037508,-20037508,20037508,20037508",
"table": "(SELECT\n ST_Simplify(way, !scale_denominator!/4500) as way,\n admin_level\n FROM (\n SELECT a.way, a.admin_level\n FROM planet_osm_roads a\n WHERE a.boundary = 'administrative'\n AND a.admin_level IN ('0', '1', '2')\n AND a.osm_id < 0\n UNION ALL\n SELECT b.way, b.admin_level\n FROM planet_osm_roads b\n WHERE b.boundary = 'administrative'\n AND b.admin_level IN ('3', '4')\n AND b.osm_id < 0\n AND true IN (\n SELECT ST_Within(b.way, c.way)\n FROM planet_osm_polygon c\n WHERE c.boundary = 'administrative'\n AND c.admin_level = '2'\n AND c.way_area > 9000000000000\n )\n ) as admin_entitites\n ORDER BY admin_level DESC\n) AS admin_very_low_zoom",
"geometry_field": "way",
"type": "postgis",
"key_field": "",
"dbname": "gis"
},
"extent": [
-180,
-85.05112877980659,
180,
85.05112877980659
],
"id": "admin-very-low-zoom",
"properties": {
"maxzoom": 4,
"minzoom": 4
},
"advanced": {}
},
{
"name": "admin-low-zoom",
"srs-name": "900913",
Expand All @@ -1056,7 +1083,7 @@
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
"Datasource": {
"extent": "-20037508,-20037508,20037508,20037508",
"table": "(SELECT\n way,\n admin_level\n FROM planet_osm_roads\n WHERE boundary = 'administrative'\n AND admin_level IN ('0', '1', '2', '3', '4')\n ORDER BY admin_level DESC\n) AS admin_low_zoom",
"table": "(SELECT\n ST_Simplify(way, !scale_denominator!/4500) as way,\n admin_level\n FROM planet_osm_roads\n WHERE boundary = 'administrative'\n AND admin_level IN ('0', '1', '2', '3', '4')\n ORDER BY admin_level DESC\n) AS admin_low_zoom",
"geometry_field": "way",
"type": "postgis",
"key_field": "",
Expand All @@ -1070,7 +1097,8 @@
],
"id": "admin-low-zoom",
"properties": {
"maxzoom": 10
"maxzoom": 10,
"minzoom": 5
},
"advanced": {}
},
Expand Down Expand Up @@ -1257,6 +1285,60 @@
},
"advanced": {}
},
{
"name": "placenames-large-very-low-zoom",
"srs-name": "900913",
"geometry": "point",
"class": "country state",
"id": "placenames-large-very-low-zoom",
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
"Datasource": {
"extent": "-20037508,-20037508,20037508,20037508",
"table": "(SELECT\n way,\n way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels,\n name,\n ref,\n admin_level\n FROM planet_osm_polygon\n WHERE boundary = 'administrative'\n AND admin_level = '2'\n AND name IS NOT NULL\n ORDER BY admin_level ASC, way_area DESC\n) AS placenames_large_very_low_zoom",
"geometry_field": "way",
"type": "postgis",
"key_field": "",
"dbname": "gis"
},
"extent": [
-180,
-85.05112877980659,
180,
85.05112877980659
],
"properties": {
"maxzoom": 3,
"minzoom": 2
},
"advanced": {}
},
{
"name": "placenames-large-low-zoom",
"srs-name": "900913",
"geometry": "point",
"class": "country state",
"id": "placenames-large-low-zoom",
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
"Datasource": {
"extent": "-20037508,-20037508,20037508,20037508",
"table": "(SELECT\n way,\n way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels,\n name,\n ref,\n admin_level\n FROM (\n SELECT a.way, a.way_area, a.name, a.ref, a.admin_level\n FROM planet_osm_polygon a\n WHERE a.admin_level = '2'\n AND a.name IS NOT NULL\n UNION ALL\n SELECT b.way, b.way_area, b.name, b.ref, b.admin_level\n FROM planet_osm_polygon b\n WHERE b.admin_level = '4'\n AND b.name IS NOT NULL\n AND true IN (\n SELECT ST_Within(b.way, c.way)\n FROM planet_osm_polygon c\n WHERE c.boundary = 'administrative'\n AND c.admin_level = '2'\n AND c.way_area > 9000000000000\n )\n ) as admin_entities\n ORDER BY admin_level ASC, way_area DESC\n) AS placenames_large_low_zoom",
"geometry_field": "way",
"type": "postgis",
"key_field": "",
"dbname": "gis"
},
"extent": [
-180,
-85.05112877980659,
180,
85.05112877980659
],
"properties": {
"maxzoom": 4,
"minzoom": 4
},
"advanced": {}
},
{
"name": "placenames-large",
"srs-name": "900913",
Expand All @@ -1279,7 +1361,7 @@
85.05112877980659
],
"properties": {
"minzoom": 2
"minzoom": 5
},
"advanced": {}
},
Expand Down
Loading

0 comments on commit 4850965

Please sign in to comment.