ngageoint / geopackage-js

GeoPackage JavaScript Library
http://ngageoint.github.io/geopackage-js/
MIT License
308 stars 78 forks source link

implement SQL over HTTP #188

Open mmomtchev opened 1 year ago

mmomtchev commented 1 year ago

I am the author of sqlite-wasm-http - an HTTP VFS driver for SQLite WASM - the new official WASM distribution from the SQLite team.

I have used it to create an Openlayers plugin that can render maps in remote .mbtiles sources over HTTP - ol-mbtiles. It has an absolutely amazing performance - even when interacting with multi-gigabytes remote packages.

I have also created a DbAdapter backend for geopackage-js - this one is however unusable at the moment because of its abysmal performance. geopackage-js takes a much more wasteful approach when it comes to SQL:

When used carefully, SQL over HTTP can be very fast - you can check my mbtiles demos - besides the two extra seconds at initialization - the rest is indistinguishable from serving raw tiles. It is a potentially game-changing technology.

I am willing to contribute my backend, which supports both Node.js and browsers - if you are willing to accept having a third SQL backend. It is based on the official SQLite WASM. Or - there is also another alternative implementation - @phiresky/sql.js-httpvfs - based on sql.js - which is the original implementation from which I drew inspiration.

However the real question is, can the SQL be fixed and will you accept sweeping changes in the tile requesting code? Obviously, this optimization won't support reprojection. I am willing to invest significant amounts of time if needed?

You can check my current (painfully slow) demo at https://mmomtchev.github.io/ol-gpkg/#StLouis and the DbAdapter at https://github.com/mmomtchev/ol-gpkg/tree/main/src

danielbarela commented 1 year ago

This library must support the entire GeoPackage spec which includes reprojection. If your optimizations do not support that, we would not be able to use it, but any other optimizations would be great as long as the library continues to support the GeoPackage spec.