-
Notifications
You must be signed in to change notification settings - Fork 47
/
dbf.html
42 lines (32 loc) · 1.19 KB
/
dbf.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
<html>
<head>
<title>Javascript DBF Loader</title>
<script type="text/javascript" src="lib/binaryajax.js"></script>
<script type="text/javascript" src="src/binarywrapper.js"></script>
<script type="text/javascript" src="src/dbf.js"></script>
<script type="text/javascript">
var file = "thematicmapping/TM_WORLD_BORDERS_SIMPL-0.3.dbf";
window.onload = function() {
var b = new BinaryAjax(file, onBinaryAjaxComplete, onBinaryAjaxFail);
}
function onBinaryAjaxFail() {
alert('failed to load ' + file);
}
function onBinaryAjaxComplete(oHTTP) {
var binFile = oHTTP.binaryResponse;
if (window.console && window.console.log) console.log('got data, parsing dbf');
var dbf = new DbfFile(binFile);
if (window.console && window.console.log) console.log(dbf);
for (var i = 0; i < dbf.header.recordCount; i++) {
var record = dbf.records[i];
if (window.console && window.console.log) console.log(record);
}
}
</script>
</head>
<body>
<h1>Javascript DBF Loader</h1>
<p>Loading dbf... uninformative errors may appear in the dark crevices of your browser.</p>
<p>See <a href="http://github.com/RandomEtc/shapefile-js">http://github.com/RandomEtc/shapefile-js</a> for more details.</p>
</body>
</html>