Skip to content

Commit

Permalink
switch out cinnabar map theme with own mapstyle by @ENT8R and myself
Browse files Browse the repository at this point in the history
  • Loading branch information
westnordost committed Jan 31, 2018
1 parent 9f25eeb commit 539413e
Show file tree
Hide file tree
Showing 26 changed files with 407 additions and 5,453 deletions.
4,926 changes: 0 additions & 4,926 deletions app/src/main/assets/cinnabar-style-8.0.0.yaml

This file was deleted.

Binary file removed app/src/main/assets/fonts/OpenSans-Bold.woff
Binary file not shown.
Binary file removed app/src/main/assets/fonts/OpenSans-Italic.woff
Binary file not shown.
Binary file removed app/src/main/assets/fonts/OpenSans-Light.woff
Binary file not shown.
Binary file removed app/src/main/assets/fonts/OpenSans-Regular.woff
Binary file not shown.
Binary file removed app/src/main/assets/fonts/OpenSans-Semibold.woff
Binary file not shown.
Binary file not shown.
Binary file removed app/src/main/assets/images/[email protected]
Binary file not shown.
65 changes: 65 additions & 0 deletions app/src/main/assets/map_theme/global.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
global:
text_font_family: 'Montserrat'
text_stroke_color: 'white'
text_stroke: { color: global.text_stroke_color, width: 2.5px }
text_places_stroke: { color: global.text_stroke_color, width: 2.5px }
text_fill_color: '#124'
text_size: 12px

railway_color: '#99a'
road_color: '#fff'
road_outline_color: '#cc9999'
path_color: global.road_color
path_outline_color: '#e0c9b3'

earth_color: '#f3eacc'
water_color: '#68d'
landuse_color: '#c6ddaa'

building_color: '#ccd6ee'
building_outline_color: '#b9c3d9'

boundary_color: '#e66'

name_source: |
function() {
// Use preferred language label if available
return (global.language && feature['name:'+global.language]) || feature.name;
}
suggested_min_zoom: |
function() {
return feature.min_zoom <= $zoom
}
sort_rank: function() { return feature.sort_rank; }

scene:
animated: true
background:
color: global.earth_color

camera:
fov: 80

lights:
cameralight:
type: point
diffuse: 0.3
origin: camera
ambient: 0.7

sources:
mapzen:
type: MVT
url: https://tiles.map-data.de/vector/v1/all/{z}/{x}/{y}.mvt
tile_size: 512

fonts:
Montserrat:
- weight: normal
url: fonts/Montserrat-Regular.woff
- weight: 500
url: fonts/Montserrat-Medium.woff
- weight: 700
url: fonts/Montserrat-Bold.woff
43 changes: 43 additions & 0 deletions app/src/main/assets/map_theme/layers/labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
layers:
roads:
data: { source: mapzen}
roads-labels:
filter: { $zoom: { min: 14 } }
draw:
text:
text_source: global.name_source
buffer: 8px
text_wrap: 25
max_lines: 3
font:
family: global.text_font_family
weight: normal
fill: global.text_fill_color
size: global.text_size
stroke: global.text_stroke

places:
data: { source: mapzen}
places-labels:
filter: { name: true }
draw:
text:
text_source: global.name_source
buffer: 12px
font:
fill: global.text_fill_color
family: global.text_font_family
stroke: global.text_places_stroke

buildings:
data: { source: mapzen}
address-labels:
filter: { $zoom: { min: 19 }, kind: address }
draw:
text:
text_source: addr_housenumber
font:
fill: global.text_fill_color
family: global.text_font_family
size: global.text_size
stroke: global.text_stroke
121 changes: 121 additions & 0 deletions app/src/main/assets/map_theme/layers/land.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
layers:

earth:
data: { source: mapzen}
draw:
polygons:
order: global.sort_rank
color: global.earth_color

boundaries:
data: { source: mapzen}
filter: { kind: country }
draw:
lines:
order: global.sort_rank
color: global.boundary_color
dash: [1,2]
width: 1px

water:
data: { source: mapzen}
filter: {not: {is_tunnel: true}}

draw:
lines:
order: global.sort_rank
join: round
cap: square

shore_lines:
filter: { boundary: true, $zoom: { min: 16 } }
draw:
lines-coast:
order: global.sort_rank
width: [[16,20px],[18,10m]] # actually visually 1/3
color: global.water_color

river_lines:
filter: { kind: [river, canal] }
draw:
lines:
color: global.water_color
width: [[10, 1px], [17, 6px], [18, 12m]]

stream_lines:
filter: { kind: [stream, ditch, drain], $zoom: { min: 15 }}
draw:
lines:
color: global.water_color
width: [[15, 1px], [17, 2px], [18, 5m]]

water_areas:
draw:
polygons:
order: global.sort_rank
color: global.water_color


buildings:
data: { source: mapzen}
filter: {not: { location: underground }, $zoom: { min: 16 } }

draw:
buildings-style:
order: global.sort_rank
color: global.building_color
extrude: true
buildings-outline-style:
order: function() { return feature.sort_rank+1; }
color: global.building_outline_color
width: [[16, 1px], [18,2px], [19,4px]]
extrude: true

landuse:
data: { source: mapzen}
draw:
polygons:
order: global.sort_rank
color: global.landuse_color

city_walls:
filter: { kind: [city_wall, dam] }
draw:
buildings-outline-style:
order: global.sort_rank
color: global.building_outline_color
width: [[12, 4px], [18, 8m]]
walls:
filter: { kind: [wall, retaining_wall, fence] }
draw:
buildings-outline-style:
order: global.sort_rank
color: global.building_outline_color
width: [[15, 1px], [18, 2m]]

styles:
buildings-style:
base: polygons
blend: opaque
buildings-outline-style:
base: lines
blend: inlay
lines-coast:
base: lines
texcoords: true
blend: inlay
shaders:
uniforms:
u_waves: 1.5
u_speed: 0.08
u_color: [0.6,0.7,1.,1.]
blocks:
color: |
float x = (v_texcoord.x - 0.495) * 2.;
if(x > 0.0) {
float opacity = 1.-x;
float waves = fract(u_waves*(1.-x)-u_time*u_speed);
color = mix(color, u_color, opacity * waves);
} else {
color.a = 0.0;
}
93 changes: 93 additions & 0 deletions app/src/main/assets/map_theme/layers/roads.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
layers:
railway:
filter: { kind: rail, not: { is_tunnel: true } }
data: { source: mapzen , layer: roads}
draw:
lines-railway-style:
order: global.sort_rank
color: global.railway_color
join: round
width: [[10, 0.5px], [12, 1.0px], [13, 2px], [18, 3m]]

roads:
data: { source: mapzen}
filter:
not:
- kind: [rail, ferry, aerialway, piste]
- kind_detail: [sidewalk]
- is_tunnel: true
draw:
lines:
order: global.sort_rank
join: round
cap: round
color: global.road_color
width: [[5, 1px], [12, 2px], [16, 5px], [17, 8m]]

aeroway:
filter: { kind: aeroway }
draw:
lines:
order: global.sort_rank
width: 80m

highway:
filter: { kind: highway, not: { is_link: true } }
draw:
lines:
width: [[8, 2px], [14, 5px], [15, 30m]]

major_road:
filter: { kind: major_road }
draw:
lines:
width: [[9, 1px], [14, 2px], [16, 6px], [19, 12m]]

minor_road:
filter: { kind: minor_road, not: { kind_detail: service } }
draw:
lines:
width: [[11, 0.5px], [12, 0.75px], [13, 1.0px], [14, 1.2px], [15, 2.5px], [16, 8m]]

service_road:
filter: { kind: minor_road, kind_detail: service }
draw:
lines:
width: [[13, 0.5px], [17, 3px], [18, 4m]]

path:
filter: { kind: [path, portage_way] }
draw:
lines:
color: global.path_color
width: [[14, 0.5px], [15, 1px], [19, 2m]]

steps:
filter: { kind_detail: steps }
draw:
lines:
dash: [0.6,0.4]
cap: butt
dash_background_color: global.path_outline_color

road-outline:
filter: { $zoom: { min: 15 }, not: { kind: [path, portage_way] } }
draw:
lines:
outline:
color: global.road_outline_color
width: function () { return 1/4 * Math.log($zoom); }
order: 200

path-outline:
filter: { $zoom: { min: 17 }, kind: [path, portage_way] }
draw:
lines:
outline:
color: global.path_outline_color
width: function () { return 1/4 * Math.log($zoom); }
order: 200
styles:
lines-railway-style:
base: lines
blend: opaque
3 changes: 3 additions & 0 deletions app/src/main/assets/map_theme/scene.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import:
- streetcomplete.yaml
- streetcomplete-light-style.yaml
35 changes: 35 additions & 0 deletions app/src/main/assets/map_theme/streetcomplete-dark-style.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import:
- global.yaml
- layers/land.yaml
- layers/labels.yaml
- layers/roads.yaml

global:
text_stroke_color: '#20204e'
text_fill_color: '#ccf'

railway_color: '#903'
road_color: '#448'
road_outline_color: '#99f'
path_color: global.road_color
path_outline_color: '#96b'

earth_color: '#20204e'
water_color: '#002'
landuse_color: '#403066'

building_color: '#420'
building_outline_color: '#310'

boundary_color: '#e46'

styles:
lines-railway-style:
base: lines
blend: add
buildings-style:
base: polygons
blend: add
buildings-outline-style:
base: lines
blend: add
29 changes: 29 additions & 0 deletions app/src/main/assets/map_theme/streetcomplete-light-style.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import:
- global.yaml
- layers/land.yaml
- layers/labels.yaml
- layers/roads.yaml

global:
railway_color: '#99a'
road_color: '#fff'
road_outline_color: '#cc9999'
path_color: global.road_color
path_outline_color: '#e0c9b3'

earth_color: '#f3eacc'
water_color: '#68d'
landuse_color: '#c6ddaa'

building_color: [0.8,0.83,0.93,0.75]
building_outline_color: [0.73,0.76,0.85, 0.75]

boundary_color: '#e66'

styles:
buildings-style:
base: polygons
blend: translucent
buildings-outline-style:
base: lines
blend: translucent
Loading

3 comments on commit 539413e

@ENT8R
Copy link
Contributor

@ENT8R ENT8R commented on 539413e Jan 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the labels are not in the users language anymore...
I think you have to add language=false to the global.yaml file and then change this value at runtime like done in #745

@ENT8R
Copy link
Contributor

@ENT8R ENT8R commented on 539413e Jan 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can try to make a PR for that if you want

@westnordost
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yes, please do!

Please sign in to comment.