SQLite3 Javascript Port and it can be extended to support Spatialite Javascript for Leaflet and Openlayers Mapping

1,236 views
Skip to first unread message

Noli Sicad

unread,
Apr 26, 2012, 5:57:54 AM4/26/12
to SpatiaLite Users
Hi,

Look what I have found out.

sql.js is a port of SQLite to JavaScript, by compiling the SQLite C
code with Emscripten.

https://github.com/kripken/sql.js

Demo
http://syntensity.com/static/sql.html

I think this can be extended to support Spatialite Javascript for
Leaflet and Openlayers Mapping.

https://github.com/kripken/emscripten/wiki

With Spatialite JS, we can use Leaflet and OpenLayers Map Canvas to
render spatialite geometries in Desktop web browser.

Noli

Brad Hards

unread,
Apr 26, 2012, 6:25:08 AM4/26/12
to spatiali...@googlegroups.com
On Thursday 26 April 2012 19:57:54 Noli Sicad wrote:
> I think this can be extended to support Spatialite Javascript for
> Leaflet and Openlayers Mapping.
>
> https://github.com/kripken/emscripten/wiki
Are you planning to work on this?

> With Spatialite JS, we can use Leaflet and OpenLayers Map Canvas to
> render spatialite geometries in Desktop web browser.
How do you envisage this would work?

Brad

Noli Sicad

unread,
Apr 26, 2012, 6:44:26 AM4/26/12
to spatiali...@googlegroups.com
>> I think this can be extended to support Spatialite Javascript for
>> Leaflet and Openlayers Mapping.
>>
>> https://github.com/kripken/emscripten/wiki
> Are you planning to work on this?

No. I think SQL.js is long way to be useful. Nothing is working at this moment.

>> With Spatialite JS, we can use Leaflet and OpenLayers Map Canvas to
>> render spatialite geometries in Desktop web browser.
> How do you envisage this would work?

The same way as QuickConnect and PhoneGap Hybrid Javascript framework
for iOS and Android but on desktop.

Just like this screenshot i.e. iOS (iPad) and Spatialite library.
https://picasaweb.google.com/116847891529748214201/QGISOpenLayersAndSpatialiteTerminal#5657727835899291234

I think the earlier version of QuickConnectFamily works in desktop
safari as well if I have not mistaken, so Spatialite library works in
Safari desktop.

http://en.wikipedia.org/wiki/Multiple_phone_web-based_application_framework

Brad Hards

unread,
Apr 26, 2012, 6:52:00 AM4/26/12
to spatiali...@googlegroups.com
On Thursday 26 April 2012 20:44:26 Noli Sicad wrote:
> >> I think this can be extended to support Spatialite Javascript for
> >> Leaflet and Openlayers Mapping.
> >>
> >> https://github.com/kripken/emscripten/wiki
> >
> > Are you planning to work on this?
>
> No. I think SQL.js is long way to be useful. Nothing is working at this
> moment.
I'm not sure I understand the relevance of SQL.js to us then. Can you explain
your intent here?

> >> With Spatialite JS, we can use Leaflet and OpenLayers Map Canvas to
> >> render spatialite geometries in Desktop web browser.
> >
> > How do you envisage this would work?
>
> The same way as QuickConnect and PhoneGap Hybrid Javascript framework
> for iOS and Android but on desktop.
Sorry, I meant "how are you planning to make calls from leaflet / OpenLayers
into some spatialite-in-js product?". What would the integration / API look
like?

Brad

Noli Sicad

unread,
Apr 26, 2012, 7:19:28 AM4/26/12
to spatiali...@googlegroups.com
>> No. I think SQL.js is long way to be useful. Nothing is working at this
>> moment.
> I'm not sure I understand the relevance of SQL.js to us then. Can you
> explain
> your intent here?

sql.js is a port of SQLite to JavaScript. It means or in theory that
all SQLite3 SQL commands can be access using javascript. If we extend
SQL.js to Spatialite.js so we can also use javascript to spatialite
spatial SQL commands.

>> >> With Spatialite JS, we can use Leaflet and OpenLayers Map Canvas to
>> >> render spatialite geometries in Desktop web browser.
>> >
>> > How do you envisage this would work
>>
>> The same way as QuickConnect and PhoneGap Hybrid Javascript framework
>> for iOS and Android but on desktop.
> Sorry, I meant "how are you planning to make calls from leaflet / OpenLayers
> into some spatialite-in-js product?". What would the integration / API look
> like?

Using SQL commands in Javascript, if you have Hybrid Javascript
framework. you can access your spatialite file using the static
library (e.g. open, transact, etc.).

e.g. Select name, street, AsGeoJSON(geom) from Street_table where
street = 'Swanston';

You will get a GeoJSON representation of Swanton Street.

OpenLayers and Leaflet are Javascript mapping libraries.

Openlayers API and Leaflet API readily accepts GeoJSON.

Noli

a.fu...@lqt.it

unread,
Apr 26, 2012, 8:27:07 AM4/26/12
to spatiali...@googlegroups.com
On Thu, 26 Apr 2012 21:19:28 +1000, Noli Sicad wrote:
> sql.js is a port of SQLite to JavaScript. It means or in theory that
> all SQLite3 SQL commands can be access using javascript. If we extend
> SQL.js to Spatialite.js so we can also use javascript to spatialite
> spatial SQL commands.
>

As far as I can imagine, the most interesting promise in these
new technologies is in that some kind of "mini-gis" could be
actually implemented simply using a trivial web browser; and
may well be, simply using some smart-phone or tablet.

We already have very nice JS libraries, such as OpenLayers and
GeoExt: by directly integrating the capability to access a local
Spatial DBMS such as SpatiaLite we'll hypothetically be able to
finally get a complete and feature-rich self-standing local GIS
environment on mobiles, not necessarily depending on a connection
to an external server.

quite an interesting future perspective IMHO

bye Sandro

--
Il messaggio e' stato analizzato alla ricerca di virus o
contenuti pericolosi da MailScanner, ed e'
risultato non infetto.

Noli Sicad

unread,
Apr 26, 2012, 9:05:46 AM4/26/12
to spatiali...@googlegroups.com
The best example of SQLite3 and Javascript is Sqlite Manager in Firefox plugin.

http://code.google.com/p/sqlite-manager/

The good thing about sql.js port is, the developer is also developing emscripten

https://github.com/kripken

Noli
> --
> You received this message because you are subscribed to the Google Groups
> "SpatiaLite Users" group.
> To post to this group, send email to spatiali...@googlegroups.com.
> To unsubscribe from this group, send email to
> spatialite-use...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/spatialite-users?hl=en.
>
>

Noli Sicad

unread,
Apr 27, 2012, 1:55:09 AM4/27/12
to spatiali...@googlegroups.com
>> The same way as QuickConnect and PhoneGap Hybrid Javascript framework
>> for iOS and Android but on desktop.
> Sorry, I meant "how are you planning to make calls from leaflet / OpenLayers
> into some spatialite-in-js product?". What would the integration / API look
> like?

Using Select AsGeoJSON(geom) from tbl_street where street = 'Swanton';

The result can be rendered in Leaflet and Openlayers.

These are 2 GeoJSON examples in Leaflet and Openlayers.

1. Leaflet
http://leaflet.cloudmade.com/examples/geojson.html

2. OpenLayers
http://openlayers.org/dev/examples/geojson.html

View page source to see the code.

Having Spatialite Javascript will blow the competition again :-).

The US Army is looking seriously on Spatialite for mobile devices as
mentioned in some of the blogs.

Noli
Reply all
Reply to author
Forward
0 new messages