Code for History

"Code for History"はIT技術を歴史学上の問題の解決に使うコミュニティです。強調したいのは、我々にとってIT技術は「手段」であって「目的」ではありません。「目的」は歴史学上の問題を解決する事であって、必要であればITでない手段も活用します。常に最優先なのは、問題を解決することです。

Making the library which can parse MBTiles by Browser JavaScript

In order for a map to spread as an expressive medium to the general public, I think that the single file format accompanied by MIME-Type is required -- it is like mp3 in a sound, jpeg in a picture, mpeg in an animation.
I have considered SVGMAP as a candidate of a single file format for a long time.
But now I consider that MBTiles is more suitable for the purpose.
Since MBTiles can gather a tile, metadata, UTFGrid data, etc. in a single file and also has edit application like TileMill, so as a general-purpose file format, it is very excellent.

In order to use MBTiles now, servers, such as TileStream, must be built or hosting services, such as MapBox, must be used.
However, it is too hard to be used by ordinary people.
I think that use of ordinary people is promoted, if a small single file placing on the ordinary Cloud storage works as a map.

So, I made the library which can parse MBTiles by JavaScript on a browser.
A repository is in github, and the working sample is shown at jsFiddle.
Checking of operations was carried out by IE10 on Windows 7, Chrome25 on Mac, Safari6.0.3 on Mac, FireFox19.0.2 on Mac, Opera12.14 on Mac, and Mobile Safari on iOS6.
By the problem which has not mounted ArrayBuffer, it does not work on IE9 and Android.
Moreover, on the Chrome of Android, it does not work by the problem of memory, either.

Since there is 2 MB of program and 10 MB of data, the first instruction execution time is kept waiting very much.
However, the 2nd time and afterwards, in order that cache may work, it operates very lightweight even on iOS.

The display of a map becomes after reading completion of data, and displaying data one by one is impossible.
I consider that I should just argue about such specification in the future.
This is just the springboard for discussion.

© Code for History