forked from summer4096/hoverboard
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexample.js
110 lines (100 loc) · 2.78 KB
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
var map = L.map('map', {
center: [40.7258,-73.9806],
zoom: 12
});
var url = window.xyz_tile_source_url;
var colors = {
base: '#f7ecdc',
land: '#f7ecdc',
water: '#357abf',
grass: '#E6F2C1',
beach: '#FFEEC7',
park: '#a5af6e',
cemetery: '#D6DED2',
wooded: '#C3D9AD',
agriculture: '#F2E8B6',
building: '#b3bdc4',
hospital: 'rgb(229,198,195)',
school: '#FFF5CC',
sports: '#B8E6B8',
residential: '#f7ecdc',
commercial: '#f7ecdc',
industrial: '#f7ecdc',
parking: '#EEE',
big_road: '#673919',
little_road: '#b29176',
railway: '#ef7369'
};
L.tileLayer.hoverboard(url, {hidpiPolyfill: true})
.render('landuse')
.minZoom(12)
.fillBy('kind', {
allotments: colors.base,
apron: colors.base,
cemetery: colors.cemetery,
cinema: colors.base,
college: colors.school,
commercial: colors.industrial,
common: colors.residential,
farm: colors.park,
farmland: colors.park,
farmyard: colors.park,
footway: colors.little_road,
forest: colors.park,
fuel: colors.base,
garden: colors.park,
glacier: colors.water,
golf_course: colors.sports,
grass: colors.park,
hospital: colors.hospital,
industrial: colors.industrial,
land: colors.land,
library: colors.school,
meadow: colors.park,
nature_reserve: colors.park,
park: colors.park,
parking: colors.parking,
pedestrian: colors.little_road,
pitch: colors.base,
place_of_worship: colors.base,
playground: colors.sports,
quarry: colors.industrial,
railway: colors.railway,
recreation_ground: colors.park,
residential: colors.residential,
retail: colors.industrial,
runway: colors.base,
school: colors.school,
scrub: colors.park,
sports_centre: colors.sports,
stadium: colors.sports,
taxiway: colors.little_road,
theatre: colors.industrial,
university: colors.school,
village_green: colors.park,
wetland: colors.water,
conservation: colors.park,
wood: colors.wooded,
urban_area: colors.residential,
park: colors.park,
brownfield: colors.park,
protected: colors.park,
protected_area: colors.park
})
.render('roads')
.where('kind', ['major_road', 'highway', 'rail'])
.stroke(1.75, 'rgba(255, 255, 255, 0.5)')
.stroke(0.75, colors.big_road)
.render('roads')
.where('kind', ['minor_road', 'path'])
.stroke(1, 'rgba(255, 255, 255, 0.5)')
.stroke(0.5, colors.little_road)
.render('buildings')
.fill('#888896')
.stroke(0.5, 'rgba(0,0,0,0.4)')
.render('water')
.where('kind', ['ocean', 'reservoir', 'lake', 'dam', 'river'])
.fill(colors.water)
.stroke(0.5, colors.water)
.addTo(map);
var hash = L.hash(map);