ol-load-geopackage 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,11 +10,11 @@ The current version was tested with OpenLayers 10.7, but should work with OpenLa
|
|
|
10
10
|
|
|
11
11
|
Each example (in the [GitHub repository](https://github.com/richard-thomas/ol-load-geopackage)) is presented as HTML/JavaScript source code and as directly viewable web pages (built using both [Vite](https://vite.dev/) and the [Webpack](https://webpack.js.org/) module bundler).
|
|
12
12
|
|
|
13
|
-
- Basic Example: web page: [Vite](https://richard-thomas.github.io/ol-load-geopackage/examples-vite/basic_example.html), [Webpack](https://richard-thomas.github.io/ol-load-geopackage/examples/dist/basic_example.html) (sources: [Vite HTML](https://github.com/richard-thomas/ol-load-geopackage/tree/master/examples-vite/basic_example.html), [Webpack HTML](https://github.com/richard-thomas/ol-load-geopackage/tree/master/examples/dist/basic_example.html),
|
|
13
|
+
- Basic Example: web page: [Vite](https://richard-thomas.github.io/ol-load-geopackage/examples-vite/dist/basic_example.html), [Webpack](https://richard-thomas.github.io/ol-load-geopackage/examples/dist/basic_example.html) (sources: [Vite HTML](https://github.com/richard-thomas/ol-load-geopackage/tree/master/examples-vite/basic_example.html), [Webpack HTML](https://github.com/richard-thomas/ol-load-geopackage/tree/master/examples/dist/basic_example.html),
|
|
14
14
|
[JavaScript (common)](https://github.com/richard-thomas/ol-load-geopackage/tree/master/examples/src/basic_example.js))
|
|
15
15
|
- Loads vector tables and associated QGIS "layer_styles" SLD XML strings from an OGC GeoPackage and render all tables as layers on an OpenLayers map. Displays details of package contents.
|
|
16
16
|
|
|
17
|
-
- Proj4 Example: web page: [Vite](https://richard-thomas.github.io/ol-load-geopackage/examples-vite/proj4_example.html), [Webpack](https://richard-thomas.github.io/ol-load-geopackage/examples/dist/proj4_example.html) (sources: [Vite HTML](https://github.com/richard-thomas/ol-load-geopackage/tree/master/examples-vite/proj4_example.html), [Webpack HTML](https://github.com/richard-thomas/ol-load-geopackage/tree/master/examples/dist/proj4_example.html),
|
|
17
|
+
- Proj4 Example: web page: [Vite](https://richard-thomas.github.io/ol-load-geopackage/examples-vite/dist/proj4_example.html), [Webpack](https://richard-thomas.github.io/ol-load-geopackage/examples/dist/proj4_example.html) (sources: [Vite HTML](https://github.com/richard-thomas/ol-load-geopackage/tree/master/examples-vite/proj4_example.html), [Webpack HTML](https://github.com/richard-thomas/ol-load-geopackage/tree/master/examples/dist/proj4_example.html),
|
|
18
18
|
[JavaScript (common)](https://github.com/richard-thomas/ol-load-geopackage/tree/master/examples/src/proj4_example.js))
|
|
19
19
|
- Used in conjunction with Proj4js module to enable additional projections to those built in to OpenLayers. These other projections can be for the input source data and/or the output display projection. Also demonstrates loading required sql.js WebAssembly binary (WASM) from an external Content Delivery Network (CDN) site.
|
|
20
20
|
|
|
@@ -46,7 +46,7 @@ This package must be imported as a module - it is not designed to be loaded dire
|
|
|
46
46
|
```javascript
|
|
47
47
|
import { initSqlJsWasm, loadGpkg } from 'ol-load-geopackage';
|
|
48
48
|
|
|
49
|
-
initSqlJsWasm();
|
|
49
|
+
initSqlJsWasm('.');
|
|
50
50
|
var gpkgPromise = loadGpkg(<gpkgFile>, <displayProjection>);
|
|
51
51
|
gpkgPromise
|
|
52
52
|
.then(([dataFromGpkg, sldsFromGpkg]) => {
|
|
@@ -62,7 +62,7 @@ gpkgPromise
|
|
|
62
62
|
.catch(error => alert('ol-load-geopackage error: ' + error));
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
Note that the _initSqlJsWasm()_ statement will start the asynchronous loading of the required sql.js WebAssembly binary file sql-wasm.wasm (from the
|
|
65
|
+
Note that the _initSqlJsWasm()_ statement will start the asynchronous loading of the required sql.js WebAssembly binary file sql-wasm.wasm (from the current folder in this case), so is best placed early in the code.
|
|
66
66
|
|
|
67
67
|
### Building with Webpack
|
|
68
68
|
|
|
@@ -99,13 +99,13 @@ npm install
|
|
|
99
99
|
npm run-script sql-install
|
|
100
100
|
npm run-script build
|
|
101
101
|
```
|
|
102
|
-
|
|
102
|
+
Although you can then test the output code placed in the dist folder using the python HTTP server method (as in the Webpack example), it is easier to use Vite's built in HTTP server with:
|
|
103
103
|
|
|
104
104
|
```bash
|
|
105
105
|
npm run-script preview
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
-
The Vite dev
|
|
108
|
+
The Vite dev server can be used to automatically re-build, act as a webhost and trigger the browser to reload every time the code changes. The following script commands (defined in [package.json](https://github.com/richard-thomas/ol-load-geopackage/tree/master/examples-vite/package.json)) will start the dev server at a top level _index.html_ file which has links to the 2 examples:
|
|
109
109
|
|
|
110
110
|
```bash
|
|
111
111
|
npm run-script dev
|
|
@@ -115,9 +115,9 @@ npm run-script dev
|
|
|
115
115
|
|
|
116
116
|
The JavaScript module has 3 exported functions/constants which are described in the separate [API Specification](API.md):
|
|
117
117
|
|
|
118
|
-
- [initSqlJsWasm()](#initsqljswasmsqljswasmdir) - Initialisation: start loading of required sql.js WASM file
|
|
119
|
-
- [loadGpkg()](#loadgpkggpkgfile-displayprojection) - start loading and data extraction of GeoPackage
|
|
120
|
-
- [sql_js_version](#sql_js_version) - NPM version number of underlying sql.js module
|
|
118
|
+
- [initSqlJsWasm()](API.md#initsqljswasmsqljswasmdir) - Initialisation: start loading of required sql.js WASM file
|
|
119
|
+
- [loadGpkg()](API.md#loadgpkggpkgfile-displayprojection) - start loading and data extraction of GeoPackage
|
|
120
|
+
- [sql_js_version](API.md#sql_js_version) - NPM version number of underlying sql.js module
|
|
121
121
|
|
|
122
122
|
## Migrating from ol-load-geopackage v1.x.x
|
|
123
123
|
|
|
@@ -126,11 +126,11 @@ In v1.x.x the sql.js WASM file (sql-wasm.wasm) was implicitly loaded from the cu
|
|
|
126
126
|
```javascript
|
|
127
127
|
import loadGpkg from 'ol-load-geopackage';
|
|
128
128
|
```
|
|
129
|
-
From v2.0.0 the WASM must be explicitly loaded by invoking the new [initSqlJsWasm()](#initsqljswasmsqljswasmdir) function, with the sql-wasm.wasm file placed in the root folder if not specified as a parameter:
|
|
129
|
+
From v2.0.0 the WASM must be explicitly loaded by invoking the new [initSqlJsWasm()](API.md#initsqljswasmsqljswasmdir) function, with the sql-wasm.wasm file placed in the root folder if not specified as a parameter. In this example, it is placed in the current folder to mimic v1.x.x behaviour:
|
|
130
130
|
|
|
131
131
|
```javascript
|
|
132
132
|
import { initSqlJsWasm, loadGpkg } from 'ol-load-geopackage';
|
|
133
|
-
initSqlJsWasm();
|
|
133
|
+
initSqlJsWasm('.');
|
|
134
134
|
```
|
|
135
135
|
|
|
136
136
|
## Contributions
|