Skip to content

Commit

Permalink
Use feet for elevations instead of meters.
Browse files Browse the repository at this point in the history
I got tired of both seeing meter elevations and the way I'd done the
contour lines.  The new setup is nicer, I think.  See carto/contours.mss
for how the contour intervals are broken down by zoom level.
  • Loading branch information
asciipip committed Feb 25, 2016
1 parent f947110 commit 60a27c4
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 83 deletions.
19 changes: 15 additions & 4 deletions carto/contour-labels.mml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,24 @@
],
"Layer": [
{
"id": "contours",
"name": "contours",
"id": "contours-medium",
"name": "contours-medium",
"srs": "+proj=latlong +datum=NAD83 +ellps=GRS80 +no_defs",
"Datasource": {
"type": "postgis",
"dbname": "ned",
"table": "(SELECT way, height, CASE WHEN (CAST(height AS int) % 100) = 0 THEN 3 WHEN (CAST(height AS int) % 10) = 0 THEN 2 ELSE 1 END AS class FROM contours) AS contours",
"table": "(SELECT ele_ft, wkb_geometry FROM contours_tmp WHERE ele_ft % 250 = 0) AS contours",
"extent": "-127,23,-65,51"
}
},
{
"id": "contours-high",
"name": "contours-high",
"srs": "+proj=latlong +datum=NAD83 +ellps=GRS80 +no_defs",
"Datasource": {
"type": "postgis",
"dbname": "ned",
"table": "(SELECT ele_ft, wkb_geometry FROM contours_tmp WHERE ele_ft % 100 = 0) AS contours",
"extent": "-127,23,-65,51"
}
}
Expand All @@ -37,4 +48,4 @@
"metatile": 2,
"name": "TopOSM Contour Labels",
"description": "Contour labels layer for TopOSM."
}
}
65 changes: 22 additions & 43 deletions carto/contour-labels.mss
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,26 @@ Map {
background-color: @mapcolor;
}

#contours {
[zoom >= 11][class = 3] {
text-name: "[height]";
text-face-name: @book-fonts;
text-fill: @contourcolor;
text-placement: line;
text-halo-fill: @halocolor;
text-min-distance: 100;
text-max-char-angle-delta: 30;
[zoom < 12] {
text-size: 8;
text-halo-radius: 2;
}
[zoom >= 12][zoom < 13] {
text-size: 9;
text-halo-radius: 3;
}
}
[zoom >= 13][class = 3],
[zoom >= 13][class = 2] {
text-size: 9;
text-halo-radius: 3;
text-spacing: 550;
text-name: "[height]";
text-face-name: @book-fonts;
text-fill: @contourcolor;
text-placement: line;
text-halo-fill: @halocolor;
text-min-distance: 100;
text-max-char-angle-delta: 30;
}
[zoom >= 16][class = 1] {
text-size: 8;
text-halo-radius: 2;
text-spacing: 750;
text-name: "[height]";
text-face-name: @book-fonts;
text-fill: @contourcolor;
text-placement: line;
text-halo-fill: @halocolor;
text-min-distance: 100;
text-max-char-angle-delta: 30;
}
#contours-medium [zoom >= 13][zoom < 15] {
text-size: 8;
text-halo-radius: 2;
text-name: "[ele_ft]";
text-face-name: @book-fonts;
text-fill: @contourcolor;
text-placement: line;
text-halo-fill: @halocolor;
text-min-distance: 100;
text-max-char-angle-delta: 30;
}
#contours-high [zoom >= 15] {
text-size: 9;
text-halo-radius: 3;
text-spacing: 550;
text-name: "[ele_ft]";
text-face-name: @book-fonts;
text-fill: @contourcolor;
text-placement: line;
text-halo-fill: @halocolor;
text-min-distance: 100;
text-max-char-angle-delta: 30;
}
19 changes: 15 additions & 4 deletions carto/contour-mask.mml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,24 @@
],
"Layer": [
{
"id": "contours",
"name": "contours",
"id": "contours-medium",
"name": "contours-medium",
"srs": "+proj=latlong +datum=NAD83 +ellps=GRS80 +no_defs",
"Datasource": {
"type": "postgis",
"dbname": "ned",
"table": "(SELECT way, height, CASE WHEN (CAST(height AS int) % 100) = 0 THEN 3 WHEN (CAST(height AS int) % 10) = 0 THEN 2 ELSE 1 END AS class FROM contours) AS contours",
"table": "(SELECT ele_ft, wkb_geometry FROM contours_tmp WHERE ele_ft % 250 = 0) AS contours",
"extent": "-127,23,-65,51"
}
},
{
"id": "contours-high",
"name": "contours-high",
"srs": "+proj=latlong +datum=NAD83 +ellps=GRS80 +no_defs",
"Datasource": {
"type": "postgis",
"dbname": "ned",
"table": "(SELECT ele_ft, wkb_geometry FROM contours_tmp WHERE ele_ft % 100 = 0) AS contours",
"extent": "-127,23,-65,51"
}
}
Expand All @@ -37,4 +48,4 @@
"metatile": 2,
"name": "TopOSM Contour Mask",
"description": "Contour mask layer for TopOSM."
}
}
41 changes: 37 additions & 4 deletions carto/contours.mml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,46 @@
],
"Layer": [
{
"id": "contours",
"name": "contours",
"id": "contours-verylow",
"name": "contours-verylow",
"srs": "+proj=latlong +datum=NAD83 +ellps=GRS80 +no_defs",
"Datasource": {
"type": "postgis",
"dbname": "ned",
"table": "(SELECT way, height, CASE WHEN (CAST(height AS int) % 100) = 0 THEN 3 WHEN (CAST(height AS int) % 10) = 0 THEN 2 ELSE 1 END AS class FROM contours) AS contours",
"table": "(SELECT ele_ft, wkb_geometry FROM contours_tmp WHERE ele_ft % 200 = 0) AS contours",
"extent": "-127,23,-65,51"
}
},
{
"id": "contours-low",
"name": "contours-low",
"srs": "+proj=latlong +datum=NAD83 +ellps=GRS80 +no_defs",
"Datasource": {
"type": "postgis",
"dbname": "ned",
"table": "(SELECT ele_ft, wkb_geometry, CASE WHEN ele_ft % 500 = 0 THEN 3 WHEN ele_ft % 100 = 0 THEN 2 ELSE 1 END AS class FROM contours_tmp WHERE ele_ft % 50 = 0) AS contours",
"extent": "-127,23,-65,51"
}
},
{
"id": "contours-medium",
"name": "contours-medium",
"srs": "+proj=latlong +datum=NAD83 +ellps=GRS80 +no_defs",
"Datasource": {
"type": "postgis",
"dbname": "ned",
"table": "(SELECT ele_ft, wkb_geometry, CASE WHEN ele_ft % 250 = 0 THEN 3 WHEN ele_ft % 50 = 0 THEN 2 ELSE 1 END AS class FROM contours_tmp WHERE ele_ft % 25 = 0) AS contours",
"extent": "-127,23,-65,51"
}
},
{
"id": "contours-high",
"name": "contours-high",
"srs": "+proj=latlong +datum=NAD83 +ellps=GRS80 +no_defs",
"Datasource": {
"type": "postgis",
"dbname": "ned",
"table": "(SELECT ele_ft, wkb_geometry, CASE WHEN ele_ft % 100 = 0 THEN 3 WHEN ele_ft % 20 = 0 THEN 2 ELSE 1 END AS class FROM contours_tmp WHERE ele_ft % 10 = 0) AS contours",
"extent": "-127,23,-65,51"
}
}
Expand All @@ -37,4 +70,4 @@
"metatile": 2,
"name": "TopOSM Contours",
"description": "Contours layer for TopOSM."
}
}
93 changes: 66 additions & 27 deletions carto/contours.mss
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,80 @@ Map {
background-color: transparent;
}

#contours {
[zoom >= 10][zoom < 11] {
[class = 3] {
line-color: @contourcolor;
line-width: 0.2;
}
/*
Contours are generally grouped into three classes:
* Index contours. Periodically spaced, thicker, labeled.
* Intermediate contours. Thinner, not normally labeled.
* Supplementary contours. Thinner, dashed, only present in flatter areas.
I didn't like the way the dashed ones looked, so this just does a
two-tiered system. The index and intermediate contours roughly double
their intervals on alternate zoom levels. Here's what I mean:
| Zoom | Index | Inter. | Ratio |
|------+-------+--------+-------|
| 10 | | 200 | |
| 11 | 500 | 100 | 1:5 |
| 12 | 500 | 50 | 1:10 |
| 13 | 250 | 50 | 1:5 |
| 14 | 250 | 25 | 1:10 |
| 15 | 100 | 20 | 1:5 |
| 16 | 100 | 10 | 1:10 |
Note that the zoom 11 and 12 index contours are the same weight as the
intermediate contours. That's because they're not labeled, and they
looked kind of weird being set apart without labels.
*/

#contours-verylow {
[zoom = 10] {
line-color: @contourcolor;
line-width: 0.2;
}
[zoom >= 11][zoom < 13] {
[class = 3] {
line-color: @contourcolor;
line-width: 0.4;
}
[class = 2] {
}
#contours-low {
[zoom = 11] {
[class = 3], [class = 2] {
line-color: @contourcolor;
line-width: 0.2;
[class = 3] { line-width: 0.2; }
[class = 2] { line-width: 0.2; }
}
}
[zoom >= 13][zoom < 14] {
[class = 2], [class = 3] {
line-color: @contourcolor;
line-width: 0.4;
}
[class = 1] {
line-color: @contourcolor;
line-width: 0.15;
}
[zoom = 12] {
line-color: @contourcolor;
[class = 3] { line-width: 0.2; }
[class = 2] { line-width: 0.2; }
[class = 1] { line-width: 0.2; }
}
[zoom >= 14] {
[class = 2], [class = 3] {
}
#contours-medium {
[zoom = 13] {
[class = 3], [class = 2] {
line-color: @contourcolor;
line-width: 0.5;
[class = 3] { line-width: 0.5; }
[class = 2] { line-width: 0.2; }
}
[class = 1] {
}
[zoom = 14] {
line-color: @contourcolor;
[class = 3] { line-width: 0.5; }
[class = 2] { line-width: 0.2; }
[class = 1] { line-width: 0.2; }
}
}
#contours-high {
[zoom = 15] {
[class = 3], [class = 2] {
line-color: @contourcolor;
line-width: 0.2;
[class = 3] { line-width: 0.5; }
[class = 2] { line-width: 0.2; }
}
}
[zoom >= 16] {
line-color: @contourcolor;
[class = 3] { line-width: 0.5; }
[class = 2] { line-width: 0.2; }
[class = 1] { line-width: 0.2; }
}
}
2 changes: 1 addition & 1 deletion carto/features_labels.mml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"Datasource": {
"type": "postgis",
"dbname": "osm",
"table": "(SELECT way, name, coalesce('natural_' || \"natural\", 'aeroway_' || aeroway, 'railway_' || railway, 'landuse_' || landuse, 'leisure_' || leisure, 'amenity_' || amenity, 'boundary_' || boundary) AS feature, 0 AS way_area, 0 AS way_area_pixels, (CASE WHEN ele LIKE '%m' THEN substr(ele, 0, length(ele)-1) ELSE ele END) || ' m' as ele_w_unit FROM planet_osm_point WHERE name IS NOT NULL OR ele IS NOT NULL ORDER BY z_order, way_area DESC) AS featurenames",
"table": "(SELECT way, name, coalesce('natural_' || \"natural\", 'aeroway_' || aeroway, 'railway_' || railway, 'landuse_' || landuse, 'leisure_' || leisure, 'amenity_' || amenity, 'boundary_' || boundary) AS feature, 0 AS way_area, 0 AS way_area_pixels, round(CAST(CASE WHEN ele LIKE '%m' THEN substr(ele, 0, length(ele)-1) ELSE ele END AS NUMERIC) / 0.3048) || ' ft' as ele_w_unit FROM planet_osm_point WHERE name IS NOT NULL OR ele IS NOT NULL ORDER BY z_order, way_area DESC) AS featurenames",
"extent": "-20037508,-19929239,20037508,19929239"
}
},
Expand Down

0 comments on commit 60a27c4

Please sign in to comment.