blob: 2f403a5bf9f53d4bf2c54519ff6c441b0b772cbf (
plain)
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
|
<!doctype html>
<html>
<head>
<meta charset="utf8">
<title>Elections 2013 Map</title>
<link rel="stylesheet" href="http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.css">
<script src="http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.3/underscore-min.js"></script>
<script src="cities.json"></script>
</head>
<body>
<h1>Elections 2013 Map</h1>
<div id='map' style='width:500px;height:400px;'></div>
<script>
var map = mapbox.map('map');
map.addLayer(mapbox.layer().id('yuvadm.map-8zhg56t1'));
var markerLayer = mapbox.markers.layer();
mapbox.markers.interaction(markerLayer);
map.addLayer(markerLayer);
map.centerzoom({lat: 31.54, lon: 35.23}, 7);
_.each(cities, function(v, k){
if (v.status == "OK") {
var location = v.results[0].geometry.location;
markerLayer.add_feature({
geometry: { coordinates: [location.lng, location.lat] },
properties: {
// 'marker-color': '#000',
// 'marker-symbol': 'star-stroked',
title: k
}
});
};
});
</script>
</body>
</html>
|