-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
209 lines (175 loc) · 6.08 KB
/
index.html
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title> American Indian, Alaskan Native and Native Hawaiian Lands by Laura Newman Eckstein.
</title>
<meta name="description" content="About Laura Newman Eckstein" />
<meta name="keywords" content="Laura Newman Eckstein, Laura Eckstein, Laura N Eckstein" />
<meta name="author" content="Laura Newman Eckstein" />
<link rel="shortcut icon" href="images/favicon.ico">
<link rel="stylesheet" href="css/leaflet.css" />
<link rel="stylesheet" href="https://api.tiles.mapbox.com/mapbox.js/plugins/leaflet-fullscreen/v0.0.3/leaflet.fullscreen.css" />
<link rel="stylesheet" href="css/gh-fork-ribbon.css" />
<link rel="stylesheet" href="css/leaflet-search.css" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Oswald:300" />
<style>
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 100%;
width: 100%;
}
.info {
padding: 20px 86px 20px 20px;
font-size: 14px;
font-family: 'Oswald', sans-serif;
font-style: 300;
background: white;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
border-radius: 5px;
}
.info h4 {
margin-right: auto;
color: black;
font-family: 'Oswald', sans-serif;
font-style: bold;
font-size: 18px;
}
.legend {
line-height: 18px;
color: #555;
}
.legend i {
width: 18px;
height: 18px;
float: left;
margin-right: auto;
opacity: 100;
}
</style>
</head>
<body>
<div id="map" class="map"></div>
<a href="https://github.com/lauraneckstein/nativelands"><img style="position: absolute; top: 0; right: 0; border: 0; z-index: 1000;" src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"></a>
<script src="js/leaflet-src.js"></script>
<script src="js/ainh.js"></script>
<script src="https://api.tiles.mapbox.com/mapbox.js/plugins/leaflet-fullscreen/v0.0.3/Leaflet.fullscreen.min.js"></script>
<script src="js/leaflet-search.src.js"></script>
<script src="js/share.min.js"></script>
<script>
var map = L.map('map', {
center: [39, -98],
zoom: 3,
zoomControl: true,
fullscreenControl: true
});
var lines = L.tileLayer('http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', { attribution:'© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, © <a href="https://carto.com/attributions">CARTO</a>'
}).addTo(map);
var info = L.control();
info.onAdd = function (map) {
this._div = L.DomUtil.create('div','info');
this.update();
return this._div;
};
info.update = function (props) {
this._div.innerHTML = '<h4>American Indian, Alaskan Native, and Native Hawaiian (AIANNH) Homelands <br> Produced by <a href="http://lauraneckstein.com">Laura Newman Eckstein</a> <br></h4>' + (props ?
'<b><br>' + props.NAMELSAD : '');
};
info.addTo(map);
function getColor(AIANNHCE) {
return AIANNHCE > 9500 ? '#cab2d6' :
AIANNHCE > 9000 ? '#ff7f00' :
AIANNHCE > 8000 ? '#fdbf6f' :
AIANNHCE > 6000 ? '#e31a1c' :
AIANNHCE > 5900 ? '#fb9a99' :
AIANNHCE > 5500 ? '#33a02c' :
AIANNHCE > 5000 ? '#b2df8a' :
AIANNHCE > 4800 ? '#1f78b4' :
'#a6cee3';
}
function style(feature) {
return {
weight: 1,
opacity: 1,
color: 'black',
dashArray: '3',
fillOpacity: 0.7,
fillColor: getColor(feature.properties.AIANNHCE)
};
}
function highlightFeature(e) {
var layer = e.target;
layer.setStyle({
weight: 5,
color: '#666',
dashArray: '',
fillOpacity: 0.7
});
if (!L.Browser.ie && !L.Browser.opera) {
layer.bringToFront();
}
info.update(layer.feature.properties);
}
var geojson;
function resetHighlight(e) {
geojson.resetStyle(e.target);
info.update();
}
function zoomToFeature(e) {
map.fitBounds(e.target.getBounds());
}
function onEachFeature(feature, layer) {
layer.on({
mouseover: highlightFeature,
mouseout: resetHighlight,
click: zoomToFeature
});
}
geojson = L.geoJson(indian, {
style: style,
onEachFeature: onEachFeature
}).addTo(map);
map.attributionControl.addAttribution('AIANNH Data © <a href="http://census.gov/">US Census Bureau</a>');
var legend = L.control({position: 'bottomright'});
legend.onAdd = function (map) {
var div = L.DomUtil.create('div', 'info legend'),
grades = [0, 4800, 5000, 5500, 5900, 6000, 8000, 9000, 9500],
key_labels = ["Federally Recognized Legal American Indian area",
"American Indian Joint-Use Area",
"Hawaiian Home Land",
"Oklahoma Tribal Statistical Area",
"Joint-Use Oklahoma Tribal Statistical Area",
"Alaska Native Village Statistical Area",
"Tribal Designated Statistical Area",
"State Recognized Legal American Indian Area",
"State Designated Tribal Statistical Area"],
labels = ["Types of AIANNH Land" + "</br>"],
spaces = [" "],
from, to;
for (var i = 0; i < grades.length; i++) {
from = grades[i];
to = grades[i + 1];
labels.push(
'<i style="background:' + getColor(from + 1) + '"></i> ' + spaces + key_labels[i] + "</br>");
}
div.innerHTML = labels.join('<br>');
return div;
};
legend.addTo(map);
var searchControl = new L.Control.Search({layer: geojson, propertyName: 'NAMELSAD', circleLocation:true, zoom: 6});
searchControl.on('search_locationfound', function(e) {
e.layer.setStyle({fillColor: '#3f0'});
}).on('search_collapsed', function(e) {
featuresLayer.eachLayer(function(layer) {
featuresLayer.resetStyle(layer);
});
});
map.addControl(searchControl);
</script>
</body>
</html>