From c8c5a6c32c3ea26d3de1bc9ae3b793c8680ce00b Mon Sep 17 00:00:00 2001 From: Tom Carden Date: Sun, 22 Nov 2009 20:07:49 -0800 Subject: [PATCH] actually reading values from the dbf now, bad thematic mapping is go --- dbf.js | 26 ++++++++--- index.html | 65 +++++++++++++++++++++------ shp.html | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 203 insertions(+), 18 deletions(-) create mode 100644 shp.html diff --git a/dbf.js b/dbf.js index e8e763e..fad8925 100644 --- a/dbf.js +++ b/dbf.js @@ -1,9 +1,28 @@ // ported from http://code.google.com/p/vanrijkom-flashlibs/ under LGPL v2.1 -function DbfHeader(src) { - +function DbfFile(src) { var t1 = new Date().getTime(); + this.header = new DbfHeader(src); + + var t2 = new Date().getTime(); + if (window.console && window.console.log) console.log('parsed dbf header in ' + (t2-t1) + ' ms'); + + t1 = new Date().getTime(); + + this.records = []; + for (var i = 0; i < this.header.recordCount; i++) { + var record = getRecord(src, this.header, i); + this.records.push(record); + } + + t2 = new Date().getTime(); + if (window.console && window.console.log) console.log('parsed dbf records in ' + (t2-t1) + ' ms'); + +} + +function DbfHeader(src) { + var binState = { offset: 0, bigEndian: true }; // endian: @@ -50,9 +69,6 @@ function DbfHeader(src) { } this.recordsOffset = this.headerSize+1; - - var t2 = new Date().getTime(); - if (window.console && window.console.log) console.log('parsed dbf in ' + (t2-t1) + ' ms'); } diff --git a/index.html b/index.html index 63b4703..7603f9f 100644 --- a/index.html +++ b/index.html @@ -3,35 +3,61 @@ Binary AJAX + + + +

Binary Ajax Shapefile Loader

+

Loading shapefile... uninformative errors may appear in the dark crevices of your browser.

+ +

See http://github.com/RandomEtc/shapefile-js for more details.

+ +