SVGOpen 2008 workshop proposal

Build an offline SQLiteSVG application with Firefox

Introduction

As of Firefox 2 the Mozilla team introduced mozStorage, a database API to communicate with local, flat file SQLite databases through C++ or Javascript. This workshop will show how to create a clientside, database driven SVG application utilizing this setup. It's targeted at SVG developers with a thorough knowledge of scripting and beginning to intermediate knowledge of relational databases, respectively the use of SQL. As the provided example deals with mapping, interest in mapping and GIS is welcome, although not crucial to be able follow the workshop.

Contents

The course will last for 150 minutes and is divided into three sections

  1. Introduce SQLite and prepare the database

    What is SQLite [1]? Learn how to create, query and modify a SQLite database with the SQLite Manager [2] extension. Load GIS data (Shapefiles) and tabular data using the ogr2ogr utility provided by GDAL [3]

  2. Firefox and mozStorage

    Why and how does Firefox use mozStorage [4] in combination with SQLite? Create a simple Javascript library that uses mozStorage to query and modify a SQLite database. Deal with security issues when using mozStorage.

  3. Build a thematic map for the region of Tasmania

    Use SQL-statements to query point, line, polygon or annotation layers along with additional data for tooltips, styling and the like. Build a Javascript library to transform "Well-known Text" (WKT [5]) presentation of geometry columns to appropriate SVG path or circle elements. Add a thematic layer with coloured, scaled circles presenting power stations by type and capacity. Query and display detailed data onclick. Modify and store label position of annotations.

Prerequisites

All you need to create the sample application is a Texteditor of your choice and Firefox 3 with the SQLite Manager extension on Linux, Mac or Windows. A sample database with geometry and data for the region of Tasmania will be provided. Vector and statistical data for the demo SQLite database has been downloaded from Geoscience Australia [6][7] and is used under license.

Demo-Files

As this example demonstrates clientside database storage it must be run locally. Please download tasmania.tar.gz, unpack it, open tasmania_init.html with Firefox 2 or 3 and continue to the demo (Screenshot).

Links


Valid XHTML 1.0 Strict

Page: http://svg.cc/sqlite/course.html
Author: Klaus Förster <klaus.foerster@svg.cc>
Version: $Id$