Closed berkayoruc closed 3 years ago
It appears that the sqljs version you are using does not include rtree in the build. How did you build this?
sqljs version is 1.4.0.
You can't use that version. Sql.js made the decision to not include rtree in the build (see: https://github.com/sql-js/sql.js/issues/59 ). I had to create a new package and publish it, so you must use rtree-sql.js v 1.0.0
Oh thank you. But this update function or update sql statement affect local gpkg or just virtual gpkg?
If you are using a browser, and consequentially sql.js, everything is read into memory, which is also where the changes are made if you run any update statements. After you have made your changes, to save the file, you will have to do something like this:
window.saveGeoPackage = function() {
geoPackage.export(function(err, data) {
fileName = fileName || 'geopackage.gpkg';
saveByteArray([data.buffer], fileName.substring(0, fileName.lastIndexOf('.')) + '.gpkg');
});
};
const saveByteArray = (function() {
const a = document.createElement('a');
document.body.appendChild(a);
a.style = 'display: none';
return function(data, name) {
const blob = new Blob(data, { type: 'octet/stream' }),
url = window.URL.createObjectURL(blob);
a.href = url;
a.download = name;
a.click();
window.URL.revokeObjectURL(url);
};
})();
Yes, I am developing for browser. So, it is not efficient way usign gpkg or any local files to editing.
Hello developers. I want to update geometry of feature but I cannot find any method about it. Is it possible update local file or how can I do that? I try
and error is no such module: rtree