GeoTIFF / GeoTIFF/georaster

QWebengineview ( Qt/C++) Uncaught ReferenceError: parseGeoraster is not defined

Open
#93 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
96
Forks
37
PR merge metrics
No merged PRs in 30d

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**

```C++
#include
#include

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**

```html


***


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();
});
}
}
});

}

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with index.html and main.cpp, then inspect georaster.browser.bundle.min.js through the qrc-loaded QWebEngineView. Compare the bundled script's loading and console errors with the working localhost page, including the relative asset paths. Done means the qrc page exposes parseGeoraster and processes the example TIFF without the reported ReferenceError.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, javascript
Domain
desktop-dev, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.