Comments (10)
@aviklai
Thanks for reporting this issue. Unfortunately I'm not familiar with the LZW decompression code and am currently bogged down with other tasks. Maybe @m0ose can have a look?
from geotiff.js.
@constantinius Thanks for the quick reply.
Also, just wanted to point out that this is a valid tiff - I can look at it's metadata with gdalinfo and it can be opened with a software like QGIS.
from geotiff.js.
I was just looking at the lzw code and wouldn't this make more sense (see below), because EOI_CODE will always be greater than CLEAR_CODE, so the if(code=== EOI_CODE) would never get hit? at line: https://github.com/geotiffjs/geotiff.js/blob/master/src/compression/lzw.js#L92
if (code === EOI_CODE) {
break;
} else {
const val = getDictionaryReversed(code);
appendReversed(result, val);
oldCode = code;
}
if (code > CLEAR_CODE) {
throw new Error(`corrupted code at scanline ${code}`);
}
from geotiff.js.
I know it is very late for that issue but I just made a fix for this issue with 6cfa2c5. Iadded the tiff as a test case.
Please let me know if this fixes the case for you.
from geotiff.js.
@constantinius Hi,
Thanks.
Currently, I don't have any project that I can test the tiff with but if you say that it works for the example tiff I attached, that's great.
Do you think it's o.k to use the library in production with LZW tiffs?
from geotiff.js.
For me that is hard to judge. The LZW decoder was written by a user of geotiff.js and since I haven't dug into the subject matter (apart from fixing obvious issues) I cannot tell how compliant it is. In the past LZW decoding has had several problems which are fixed now.
Deflate support, for example, uses the pako
library, a third party maintained lib with over 10 million weekly downloads. So if you are opting for stability, I would favor deflate
.
from geotiff.js.
Thanks for that valuable info @constantinius ^^
I've had trouble rendering tiffs with lzw
compression in Firefox (MacOS), e.g:
RangeError: offset is outside the bounds of the DataView geotiffimage.js:448
RangeError: invalid or out-of-range index
when trying to render tiffs that worked fine elsewhere (e.g. same tiff rendered fine in other browsers, or in GIS software such as QGIS).
Using deflate
compression when generating the tiffs avoided this issue - and yeilds a much better compression rate for my data.
from geotiff.js.
Hi @danwild
Thanks for reporting this. Is this related to #160?
What version of geotiff.js are you using with the lzw
file? Would you mind sharing the LZW compressed image so that we can debug the LZW related code?
from geotiff.js.
I don't think it was related to #160 @constantinius, however I'm now unable to reproduce (against [email protected]
browser)..
I'm using geotiff.js in a leaflet.js context, so it's possible my problem may have been caused by something in their bindings.
Will post example if I see the issue again.
from geotiff.js.
Thanks!
from geotiff.js.
Related Issues (20)
- The exports `package.json` needs a new paint job HOT 3
- How do I use compression? HOT 3
- Typescript compilation error in BaseClient HOT 14
- Writing GeoTiffs HOT 3
- Reading files larger than 4gb? HOT 1
- image.readRasters() HOT 3
- Exceeds max_safe_integer. Precision may be lost. HOT 2
- Type error at build time HOT 1
- Abort signal should be extended to `getImage` when performing slice's fetch action
- Property 'headers' does not exist on type '{}'
- Pool workers lead to memory leak? HOT 3
- using geotiff.js with react-native HOT 6
- 请升级一下lerc依赖 HOT 2
- credentials option is ignored HOT 3
- idenify does not work on GeoTiff float (Digitales Höhenmodell Oberfläche NRW) HOT 2
- Generating a geotiff from an image and a list of ground control points.
- readRGB() does not always return an interleaved array HOT 2
- Support also CommonJS HOT 4
- BlockedSource: Duplicated HTTP range requests
- capturing world coordinates form the tiff imaegs using geotiff.js HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geotiff.js.