Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ that require you to load the whole image into memory. It will also attempt to a

`right` is how many pixels in from the **right** side of the image to skip over before we start clipping

`probeExternalOverview` default to be false, if set as true, it will probe for external overview .ovr url.

*clipping resolution*

Expand Down
112 changes: 0 additions & 112 deletions dist/0.georaster.browser.bundle.worker.js

This file was deleted.

112 changes: 0 additions & 112 deletions dist/0.georaster.bundle.worker.js

This file was deleted.

112 changes: 0 additions & 112 deletions dist/1.862eb2a95af2d520fa34.worker.worker.js

This file was deleted.

112 changes: 0 additions & 112 deletions dist/1.a82f36252b70d4ad14ed.worker.worker.js

This file was deleted.

2,891 changes: 0 additions & 2,891 deletions dist/georaster.browser.bundle.js

This file was deleted.

6 changes: 3 additions & 3 deletions dist/georaster.browser.bundle.min.js

Large diffs are not rendered by default.

2,833 changes: 0 additions & 2,833 deletions dist/georaster.bundle.js

This file was deleted.

2 changes: 1 addition & 1 deletion dist/georaster.bundle.min.js

Large diffs are not rendered by default.

37 changes: 25 additions & 12 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ class GeoRaster {
this._url_is_available = typeof URL !== 'undefined';
this._options = options;

// By default, we assume the user wants to use internal overview only.
if(this._options.probeExternalOverview === undefined) {
this._options.probeExternalOverview = false;
}

// check if should convert to buffer
if (typeof data === 'object' && data.constructor && data.constructor.name === 'Buffer' && Buffer.isBuffer(data) === false) {
data = new Buffer(data);
Expand Down Expand Up @@ -93,20 +98,28 @@ class GeoRaster {
preinitialize(debug) {
if (debug) console.log('starting preinitialize');
if (this._url) {
// initialize these outside worker to avoid weird worker error
// I don't see how cache option is passed through with fromUrl,
// though constantinius says it should work: https://github.com/geotiffjs/geotiff.js/issues/61
const ovrURL = this._url + '.ovr';
return urlExists(ovrURL).then(ovrExists => {
if (debug) console.log('overview exists:', ovrExists);
if (debug) console.log('probeExternalOverviewURL?: ', this._options.probeExternalOverview);
if(this._options.probeExternalOverview === true) {
// initialize these outside worker to avoid weird worker error
// I don't see how cache option is passed through with fromUrl,
// though constantinius says it should work: https://github.com/geotiffjs/geotiff.js/issues/61
const ovrURL = this._url + '.ovr';
return urlExists(ovrURL).then(ovrExists => {
if (debug) console.log('overview exists:', ovrExists);
this._options = Object.assign({}, {cache: true, forceXHR: false}, this._options);
if (debug) console.log('options:', this._options);
if (ovrExists) {
return fromUrls(this._url, [ovrURL], this._options);
} else {
return fromUrl(this._url, this._options);
}
});
}else{
this._options = Object.assign({}, {cache: true, forceXHR: false}, this._options);
if (debug) console.log('options:', this._options);
if (ovrExists) {
return fromUrls(this._url, [ovrURL], this._options);
} else {
return fromUrl(this._url, this._options);
}
});
return fromUrl(this._url, this._options);
}

} else {
// no pre-initialization steps required if not using a Cloud Optimized GeoTIFF
return Promise.resolve();
Expand Down