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
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Census</title>
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
<meta name="description" content="Displaying Census data">
<meta name="author" content="Ryan Westphal">
<link rel="stylesheet" type="text/css" href="css/style.css" />
<style type="text/css">
#map
{
position: fixed;
bottom: 0;
left: 0;
right: 0;
top: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script src="http://code.jquerygeo.com/jquery.geo-1.0a4.min.js"></script>
<script>
$(function () {
$.ajaxTransport( function( options, originalOptions, jqXHR ) {
var xdr;
return {
send: function( _, completeCallback ) {
xdr = new XDomainRequest();
xdr.onload = function() {
var responses = {
text: xdr.responseText
};
// force status code to 200, XDomainRequest rejects all other successful status codes
if (xdr.contentType.match(/\/json/)) {
options.dataTypes.push("json");
completeCallback(200, 'success', responses);
} else {
completeCallback(200, 'success', responses);
// see bug https://connect.microsoft.com/IE/feedback/ViewFeedback.aspx?FeedbackID=334804
}
};
xdr.onerror = xdr.ontimeout = function() {
var responses = {
text: xdr.responseText
};
completeCallback(400, 'failed', responses);
}
xdr.open(options.type, options.url);
xdr.send(options.data);
},
abort: function() {
if(xdr) {
xdr.abort();
}
}
};
});
// create a map
var map = $("#map").geomap({
center: [-71.0595678, 42.3604823],
zoom: 8,
services: [
{
id: "GeoIQ-acetate",
type: "tiled",
src: function (view) {
return "http://acetate.geoiq.com/tiles/acetate-base/"
+ view.zoom + "/"
+ view.tile.column + "/"
+ view.tile.row
+ ".png";
},
attr: "<p>GeoIQ Acetate layer</p>"
},
{
id: "broadbandmap-income-demographics",
type: "tiled",
src: function (view) {
return "http://www.broadbandmap.gov/StamenTiles/demographics/education/"
+ view.zoom + "/"
+ view.tile.column + "/"
+ view.tile.row
+ ".png";
},
attr: "<p>National Broadband Map income demographics</p>"
}
]
// click: function(e, geo) {
// $.ajax({
// url: "http://www.broadbandmap.gov/broadbandmap/demographic/fall2010/coordinates",
// data: {
// longitude: geo.coordinates[0],
// latitude: geo.coordinates[1],
// format: "jsonp"
// },
// dataType: "jsonp",
// success: function(result) {
// //alert(result.Results.blockFips + ": " + result.Results.educationBachelorOrGreater);
// },
// error: function(xhr) {
// alert(xhr.statusText);
// }
// })
// }
});
$.ajax({
url: "http://data.jquerygeo.com/gz_2010_25_140_00_500k.geojson",
dataType: "json",
success: function(result) {
map.geomap("append", result);
},
error: function(xhr) {
alert(xhr.statusText);
}
});
});
</script>
<script>
var _gaq = [['_setAccount', 'UA-26084853-1'], ['_trackPageview']];
(function (d, t) {
var g = d.createElement(t), s = d.getElementsByTagName(t)[0]; g.async = 1;
g.src = ('https:' == location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js';
s.parentNode.insertBefore(g, s);
} (document, 'script'));
</script>
</body>
</html>
|