-
Notifications
You must be signed in to change notification settings - Fork 37
QWebengineview ( Qt/C++) Uncaught ReferenceError: parseGeoraster is not defined #93
Copy link
Copy link
Open
Description
Describe the bug
when i created a application using georaster and QWebengineview ( Qt/C++, buildt on Qt5.10 msvc2017/Qt5.15 msvc2019 ),i encounter some annoying problems: js: Uncaught ReferenceError: parseGeoraster is not defined,but it successed to run in vscode, for example: http://127.0.0.1:3000/index.html.
main.cpp
#include <QApplication>
#include <QWebEngineView>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWebEngineView *view = new QWebEngineView();
view->load(QUrl("qrc:/web/index.html"));
view->show();
return a.exec();
}index.html
<!DOCTYPE html>
<html>
<head>
<script src="./georaster/georaster.browser.bundle.min.js"></script>
<script src="./jquery/jquery-3.7.1.min.js"></script>
</head>
<body>
<div id="container">***</div>
<script>
window.onload = () => {
// success
$.getJSON('./json/demo.json', function (data) {
document.getElementById('container').textContent = JSON.stringify(data);
});
// error
$.ajax({
url: "./tif/area.tif",
type: 'GET',
xhr: function () {
var xhr = new window.XMLHttpRequest();
xhr.responseType = 'blob';
return xhr;
},
success: function (data) {
let reader = new FileReader()
reader.readAsArrayBuffer(data)
reader.onload = function () {
let arrayBuffer = reader.result;
parseGeoraster(arrayBuffer).then(georaster => {
const min = georaster.mins[0];
const max = georaster.maxs[0];
const range = georaster.ranges[0];
document.getElementById('container').textContent = min.toString() + " " + max.toString() + " " + range.toString();
});
}
}
});
}
</script>
</body>
</html>Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels