Giter VIP home page Giter VIP logo

Comments (10)

constantinius avatar constantinius commented on June 6, 2024

@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.

aviklai avatar aviklai commented on June 6, 2024

@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.

defiantgoat avatar defiantgoat commented on June 6, 2024

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.

constantinius avatar constantinius commented on June 6, 2024

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.

aviklai avatar aviklai commented on June 6, 2024

@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.

constantinius avatar constantinius commented on June 6, 2024

@aviklai

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.

danwild avatar danwild commented on June 6, 2024

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.

constantinius avatar constantinius commented on June 6, 2024

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.

danwild avatar danwild commented on June 6, 2024

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.

constantinius avatar constantinius commented on June 6, 2024

Thanks!

from geotiff.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.