-
Notifications
You must be signed in to change notification settings - Fork 6
/
earthquakes-in-iceland-4-1706-1990.php
135 lines (115 loc) · 4.45 KB
/
earthquakes-in-iceland-4-1706-1990.php
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
<html dir="ltr" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Map of Earthquakes in Iceland 1706 - 1990 // size >4</title>
<style type="text/css" media="screen">p{padding:1px;}</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>
<body>
<h2>Map of Earthquakes in Iceland 1706 - 1990 // size >4</h2>
<div id="map" style="width:100%;height:400px"></div>
<p><img src="http://blogs.warwick.ac.uk/images/campbello/2008/02/27/richter-scale.gif?maxWidth=500" alt="Richter Scale"></p>
<script type="text/javascript" charset="utf-8">
// ####################################################################
// Start of javascript code. You should edit the functions below
// so that your map expresses the particular contents of the data
// ####################################################################
var sourcescraper = 'jarskjalftar-a-islandi-4-1706-1990';
$('#scrapername').html('<b>'+sourcescraper+'</b>');
// ####################################################################
// Set the dynamic icon for your point. For more see:
// http://code.google.com/apis/chart/docs/gallery/dynamic_icons.html
// ####################################################################
function mapicon(record)
{
col = '660099';
if (record["size"] >= 2.0)
col = '0099ff';
if (record["size"] >= 3.0)
col = '00cb98';
if (record["size"] >= 4.0)
col = '99cc66';
if (record["size"] >= 5.0)
col = '96fb32';
if (record["size"] >= 6.0)
col = 'ffff33';
if (record["size"] >= 7.0)
col = 'ffcc66';
if (record["size"] >= 8.0)
col = 'ff9966';
if (record["size"] >= 9.0)
col = 'ff3300';
if (record["size"] >= 10.0)
col = 'cc0000';
letter = 'O';
//if (record["Decision"] == "PENDING")
// letter = 'P';
icon = 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld='+letter+'|'+col+'|000';
return icon
}
// ####################################################################
// Set the tooltip title value
// ####################################################################
function mapicontext(record)
{
return "TOOLTIP " + record["size"]
}
// ####################################################################
// Set the popup text for your pin, usually with the link
// ####################################################################
function mapicontent(record)
{
return 'Size: ' + record["size"]+'</br>Date: ' +record["date"];
}
var map;
var centreset = false;
function makemap()
{
var mapOptions = { "zoom": 4, "center": new google.maps.LatLng(64.9607663214987, -18.984375),
"mapTypeId": google.maps.MapTypeId.SATELLITE };
map = new google.maps.Map(document.getElementById("map"), mapOptions);
}
function recorddata(record)
{
if (!record['latlng_lat'])
return;
pos = new google.maps.LatLng(record['latlng_lat'], record['latlng_lng']);
text = mapicontext(record);
icon = mapicon(record);
content = mapicontent(record);
marker = new google.maps.Marker({position:pos,map:map,title:text, icon:icon});
infowindow = new google.maps.InfoWindow({ content: content });
(function(j) {
google.maps.event.addListener(j.marker, "click", function(){
j.infowindow.open(map, j.marker); });
})({'marker':marker, 'infowindow':infowindow});
if (!centreset)
{ map.setCenter(pos); centreset = true }
}
var olength = 500;
var olimit = 100;
var offset = 0; 1
function gotback(r)
{
for (i = 0; i < r.length; i++)
recorddata(r[i]);
offset += olength;
if ((r.length == olength) && (offset < olimit))
loaddata();
else
$("#message").html("Total records = " + (offset - olength + r.length));
}
function loaddata()
{
$("#message").html("Loading ...");
var s = document.createElement('script');
url = "http://api.scraperwiki.com/api/1.0/datastore/getdata?&format=json&name="+sourcescraper+"&limit="+olength+"&callback=gotback&offset=" + offset;
s.setAttribute('src', url);
s.setAttribute('type', 'text/javascript');
document.getElementsByTagName('head')[0].appendChild(s);
}
$(function() { makemap(); loaddata(); });
</script>
</body>
</html>