Skip to content

Commit

Permalink
Carto-based stylesheets.
Browse files Browse the repository at this point in the history
  • Loading branch information
asciipip committed May 3, 2014
1 parent 446d02e commit 8c04416
Show file tree
Hide file tree
Showing 30 changed files with 3,349 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@
set-toposm-env
areas.xml
contours.xml
features.xml
contour-labels.xml
contour-mask.xml
features_fills.xml
features_labels.xml
features_mask.xml
features_outlines.xml
features_top.xml
hypsorelief.xml
landcoverrelief.xml
ocean.xml
include/*.inc

# These are generated by programs
custom-symbols/turning_circle*
carto/layers

*.pyc
errors.log
Expand Down
120 changes: 120 additions & 0 deletions carto/areas.mml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{
"bounds": [
-180,
-85.05112877980659,
180,
85.05112877980659
],
"center": [
0,
0,
4
],
"format": "png",
"interactivity": false,
"minzoom": 0,
"maxzoom": 22,
"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",
"Stylesheet": [
"colors.mss",
"areas.mss",
"features_water.mss"
],
"Layer": [
{
"id": "builtup",
"name": "builtup",
"Datasource": {
"file": "/home/mapnik/world_boundaries/builtup_area.shp"
},
"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"
},
{
"id": "areafills",
"name": "areafills",
"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": {
"type": "postgis",
"dbname": "osm",
"table": "(SELECT way, leisure, landuse, amenity, \"natural\" FROM planet_osm_polygon ORDER BY z_order, way_area DESC) AS areas",
"extent": "-20037508,-19929239,20037508,19929239"
}
},
{
"id": "waterareas_z2",
"name": "waterareas_z2",
"class": "waterareas_z2",
"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": {
"type": "postgis",
"dbname": "osm",
"table": "(SELECT way FROM planet_osm_polygon WHERE (waterway IN ('riverbank') OR landuse IN ('reservoir') OR \"natural\" IN ('water')) AND way_area > 5000000 ORDER BY z_order, way_area DESC) AS waterareas",
"extent": "-20037508,-19929239,20037508,19929239"
}
},
{
"id": "waterareas_z7",
"name": "waterareas_z7",
"class": "waterareas_z7",
"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": {
"type": "postgis",
"dbname": "osm",
"table": "(SELECT way FROM planet_osm_polygon WHERE (waterway IN ('riverbank') OR landuse IN ('reservoir') OR \"natural\" IN ('water')) AND way_area > 300000 ORDER BY z_order, way_area DESC) AS waterareas",
"extent": "-20037508,-19929239,20037508,19929239"
}
},
{
"id": "waterareas_z9",
"name": "waterareas_z9",
"class": "waterareas_z9",
"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": {
"type": "postgis",
"dbname": "osm",
"table": "(SELECT way FROM planet_osm_polygon WHERE (waterway IN ('riverbank') OR landuse IN ('reservoir') OR \"natural\" IN ('water')) AND way_area > 20000 ORDER BY z_order, way_area DESC) AS waterareas",
"extent": "-20037508,-19929239,20037508,19929239"
}
},
{
"id": "waterareas_z11",
"name": "waterareas_z11",
"class": "waterareas_z11",
"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": {
"type": "postgis",
"dbname": "osm",
"table": "(SELECT way FROM planet_osm_polygon WHERE (waterway IN ('riverbank') OR landuse IN ('reservoir') OR \"natural\" IN ('water')) AND way_area > 300 ORDER BY z_order, way_area DESC) AS waterareas",
"extent": "-20037508,-19929239,20037508,19929239"
}
},
{
"id": "waterareas_z14",
"name": "waterareas_z14",
"class": "waterareas_z14",
"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": {
"type": "postgis",
"dbname": "osm",
"table": "(SELECT way FROM planet_osm_polygon WHERE (waterway IN ('riverbank') OR landuse IN ('reservoir') OR \"natural\" IN ('water')) ORDER BY z_order, way_area DESC) AS waterareas",
"extent": "-20037508,-19929239,20037508,19929239"
}
},
{
"id": "waterareas_intermittent",
"name": "waterareas_intermittent",
"class": "waterareas_z11 waterareas_z14",
"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": {
"type": "postgis",
"dbname": "osm",
"table": "(SELECT way FROM planet_osm_polygon WHERE landuse IN ('basin') ORDER BY z_order, way_area DESC) AS water_areas",
"extent": "-20037508,-19929239,20037508,19929239"
}
}
],
"scale": 1,
"metatile": 2,
"name": "TopOSM Areas",
"description": "Areas layer for TopOSM."
}
88 changes: 88 additions & 0 deletions carto/areas.mss
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
Map {
background-color: transparent;
}

#builtup[zoom >= 8] {
polygon-fill: @builtupcolor;
polygon-opacity: @areaopacity;
}

#areafills {
[zoom >= 8][landuse = 'residential'] {
polygon-fill: @builtupcolor;
polygon-opacity: @areaopacity;
}
[zoom >= 8][leisure = 'nature_reserve'],
[zoom >= 8][leisure = 'park'],
[zoom >= 8][leisure = 'common'],
[zoom >= 8][leisure = 'playground'],
[zoom >= 8][leisure = 'garden'],
[zoom >= 8][leisure = 'golf_course'],
[zoom >= 8][landuse = 'forest'],
[zoom >= 8][landuse = 'vineyard'],
[zoom >= 8][landuse = 'conservation'],
[zoom >= 8][landuse = 'recreation_ground'],
[zoom >= 8][leisure = 'recreation_ground'],
[zoom >= 8][landuse = 'village_green'],
[zoom >= 8][landuse = 'allotment'] {
polygon-fill: @naturecolor;
polygon-opacity: @areaopacity;
}

[zoom >= 10][landuse = 'cemetery'],
[zoom >= 10][amenity = 'grave_yard'] {
polygon-fill: #8b8;
polygon-opacity: @areaopacity;
}

[zoom >= 10][landuse = 'construction'] {
polygon-fill: #bb3;
polygon-opacity: @areaopacity;
}
[zoom >= 8][landuse = 'military'] {
polygon-fill: #e55;
polygon-opacity: @areaopacity;
}
[zoom >= 10][natural = 'beach'] {
polygon-fill: #fec;
polygon-opacity: @areaopacity;
}
[zoom >= 8][landuse = 'salt_pond'] {
polygon-fill: #abc;
polygon-opacity: @areaopacity;
}
[zoom >= 10][natural = 'glacier'] {
polygon-fill: #cde;
polygon-opacity: @areaopacity;
}
[zoom >= 10][natural = 'heath'],
[zoom >= 10][landuse = 'meadow'],
[zoom >= 10][landuse = 'farm'],
[zoom >= 10][landuse = 'farmyard'] {
polygon-fill: #dd3;
polygon-opacity: @areaopacity;
}

// these are basically copied from osm.xml

[zoom >= 10][landuse = 'industrial'],
[zoom >= 10][landuse = 'railway'],
[zoom >= 10][landuse = 'brownfield'],
[zoom >= 10][landuse = 'landfill'],
[zoom >= 10][landuse = 'quarry'] {
polygon-fill: #e69;
polygon-opacity: @areaopacity;
}
[zoom >= 10][landuse = 'commercial'],
[zoom >= 10][landuse = 'retail'],
[zoom >= 10][amenity = 'hospital'] {
polygon-fill: #e96;
polygon-opacity: @areaopacity;
}
[zoom >= 10][amenity = 'university'],
[zoom >= 10][amenity = 'college'],
[zoom >= 10][amenity = 'school'] {
polygon-fill: #aa8;
polygon-opacity: @areaopacity;
}
}
50 changes: 50 additions & 0 deletions carto/colors.mss
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@landcolor: #999;
@builtupcolor: #444;
@naturecolor: #7e5;
@naturecolorlight: #170;
@naturecolortext: #040;
@residentialcolortext: #333;
@schoolcolortext: #545400;
@commercialcolortext: #540000;
@industrialcolortext: #54001e;

@watermaskcolor: black;
@landmaskcolor: white;

@contourcolor: #530;

@waterlinecolor: #15c;
@waterfillcolor: #adf;
@pipelinecolor: #600;

@aerowaycolor: #99a;
@aerowayoutlinecolor: #556;

@transportationcolor: #069;
@tunneloutlinecolor: #000;
@lightrailcolor: #666;
@interstatecolor: #8899EE;
@interstatecolortunnel: #C0CCFF;
@interstatecolorlowzoom: #445099;
@trunkcolor: #FF8888;
@trunkcolortunnel: #FFC0C0;
@trunkcolorlowzoom: #994444;
@primarycolor: #FFCC88;
@primarycolortunnel: #FFE6C0;
@primarycolorlowzoom: #333333;
@secondarycolor: #FFFF88;
@secondarycolortunnel: #FFFFC0;
@secondarycolorlowzoom: #333333;
@smallroadcolor: #FFFFFF;
@smallroadcolortunnel: #FFFFFF;
@smallroadcolorlowzoom: #333333;
@parkingcolor: #fffbe0;

@areaopacity: 0.2;

@halocolor: transparent;
@mapcolor: transparent;

@statenamecolor: #640;
@placenamecolor: #000;
@streetnamecolor: #000;
40 changes: 40 additions & 0 deletions carto/contour-labels.mml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"bounds": [
-180,
-85.05112877980659,
180,
85.05112877980659
],
"center": [
0,
0,
4
],
"format": "png",
"interactivity": false,
"minzoom": 0,
"maxzoom": 22,
"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",
"Stylesheet": [
"colors.mss",
"fonts.mss",
"contour-labels.mss"
],
"Layer": [
{
"id": "contours",
"name": "contours",
"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",
"extent": "-127,23,-65,51"
}
}
],
"scale": 1,
"metatile": 2,
"name": "TopOSM Contour Labels",
"description": "Contour labels layer for TopOSM."
}
48 changes: 48 additions & 0 deletions carto/contour-labels.mss
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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;
}
}
Loading

0 comments on commit 8c04416

Please sign in to comment.