Giter VIP home page Giter VIP logo

geotiffjs / geotiff.js Goto Github PK

View Code? Open in Web Editor NEW
819.0 31.0 170.0 3.56 MB

geotiff.js is a small library to parse TIFF files for visualization or analysis. It is written in pure JavaScript, and is usable in both the browser and node.js applications.

Home Page: https://geotiffjs.github.io/

License: MIT License

JavaScript 97.50% HTML 0.10% Shell 2.37% Dockerfile 0.03%
geotiff tiff-files raster-data

geotiff.js's People

Contributors

ahocevar avatar allwi290 avatar aloisklink avatar bdowning avatar bjornharrtell avatar constantinius avatar danieljdufour avatar davijo avatar dependabot[bot] avatar hgs-mlevin04 avatar ilan-gold avatar m0ose avatar manzt avatar matafokka avatar michaelbuhler avatar mike-000 avatar pacodu avatar pomax avatar remisahl avatar rouault avatar satotake avatar schpidi avatar sguimmara avatar sinergise-anze avatar thatcherc avatar themrcam avatar thomasaribart avatar tschaub avatar vincentsarago avatar zakjan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geotiff.js's Issues

Running without babel

Hey there,

Just a heads up that I'm experiencing some issues running 1.0.0-beta.3 in node in a non-babel project.

I'm doing something basic like

const GeoTIFF = require('geotiff');

GeoTIFF.fromFile('./LC80990692014143LGN00_B2.TIF')
  .then(tiff => {
    console.log(tiff)
  })
  .catch(err => {
    console.log(err)
  })

And it throws

Error: Cannot find module 'babel-runtime/helpers/possibleConstructorReturn'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15)
    at Function.Module._load (internal/modules/cjs/loader.js:475:25)
    at Module.require (internal/modules/cjs/loader.js:598:17)
   ....

Have also tried requiring geotiff.bundle.js but that left me with

TypeError: (0 , _fs.open) is not a function
    at eval (webpack-internal:///143:822:18)
    at new Promise (<anonymous>)

I'm running on node v9

Cheers
Rowan

Just a note on bigtiffs

The majority of bigtiff testing I have done is returning incorrect values for the stripOffsets.....

If anyone in the future needs the correct values for rendering data, you can just reference the first stripOffset (where your raster data starts), and then add (row * ImageWidth * 4), to get the correct value.
*assuming they are float32

Getting geotiff tiles directly

I'm trying to get some imagery from geotiff and display it as tiles on openlayers. The openlayers requests give me the bounding box of the tile it wants, so I use GeotiffImage.readRasters(). Even though the requested tile size matches the geotiff tiles, each readRasters call actually results in 4 getTileOrStrip() calls per sample. This seems very inefficient as each tile that open layers needs ends up taking 4 times longer than it should to retrieve. Possible solutions:

  1. Align openlayers tiles with the geotiff source tiles and use GeotiffImage.getTileOrStrip() directly. The result from getTileOrStrip() doesn't seem to be in the same format as what readRasters() returns, so what must I do to make it work?
  2. Have geotiff.js cache the returned tiles from getTileOrStrip() so that it doesn't need to fetch them again. Is there a way to do this?

Thanks.

Get rid of webpack?

It's really a shame you decided to use webpack for a node project, which doesn't support ES6 modules natively. The experimental flag in newer builds is half-baked and requires a custom file extension. All this makes it incredibly difficult to debug issues (at least in node), since I'm wading through webpack'd code that is hard to match to the original source and just ends up being more work.

I'm curious to try to understand your motivations? All the other ES6 stuff you're using is natively supported in node, the one exception is the new module syntax. How do you manage to debug your code in node? I spent about 20 minutes Googling for sourcemap-esque solutions before giving up.

Otherwise the project is excellent!

Performance issues likely related to decoding

We are having performance issues loading parts of a geotiff from a remote file server. After some investigation it seems like this might be entirely caused by the data decoding tasks. In the chrome debug performance tab I can see that the lzw decompress task is taking ~97% of the total processing time (which happens to be ~10 seconds for a 256x256 pixel area of an 8 channel, 16 bit per channel geotiff).
Does this sound reasonable or too slow?
Is there anything we can do to improve this? For example, can we use a different compression algorithm or have just serve the file uncompressed? Is there anything that can help on the client side, like offloading the decompression task onto the GPU (assuming it can be massively parallelized)?

Thanks!

The library doesnt import on Node.js

After installing the library with npm install geotiff and using var GeoTIFF = require("geotiff");
Nodejs fails with
`(function (exports, require, module, __filename, __dirname) { import GeoTIFF from "./geotiff.js";
^^^^^^

SyntaxError: Unexpected token import
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:387:25)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)`

Didn't work under nodejs 4.2.6.

Got this error message:

/path/to/test/node_modules/geotiff/src/dataview64.js:1
(function (exports, require, module, __filename, __dirname) { class DataView64 {
                                                              ^^^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

Still use '--use-strict' switch to workaround this issue.

getGDALMetadata error

Node.js 4.2.6.
Got

/path/to/test/node_modules/geotiff/src/geotiffimage.js:628
      XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null
      ^

ReferenceError: XPathResult is not defined
    at Object.GeoTIFFImage.getGDALMetadata (/path/to/test/node_modules/geotiff/src/geotiffimage.js:628:7)
    at /home/mvtm/projects/radar/server/src/testgt.js:15:21

Tile server implementation

Hey @constantinius

Just wanted to provide a heads up that I've started dabbling on a tile server implementation of geotiffjs.

The basic premise is

  • a node.js tile server with an x/y/z tile endpoint
  • The endpoint takes a few params, such as
    • a scene id
    • a provider (eg landsat)
      • these would be configurable so that people could point to their own buckets or new COG providers could be readily incorporated
    • a band combo for rgb rendering
  • geotiff.js loads the required portion of the geotiff
  • I then take the values and render them as a png

I've got some bones working although I've still got lots of work to do as I understand all the various libs I'm pulling in.

I'll probably tinker on it slowly but if anyone is interested feel free to check it.

Cheers
Rowan

Installation troubles

I used this library on my local machine and it worked great! Now I'm trying to put it on a server and after two days of trying I can't manage to install it properly! I'm following the instructions in the README.

Part of the issue seems to be that a lot of the modules geotiff.js uses are out of date. When I run a program using geotiff.js, its starts fine but seems to have trouble when I try to read values out of the TIFF:

TypeError: Cannot call method 'call' of undefined </br> at Object.GeoTIFFImage._readRaster (/home/thatcher/node-servers/Moon2STL/node_modules/geotiff/src/geotiffimage.js:294:87)</br> at Object.GeoTIFFImage.readRasters (/home/thatcher/node-servers/Moon2STL/node_modules/geotiff/src/geotiffimage.js:344:10)</br> at Object.getElevations (/home/thatcher/node-servers/Moon2STL/elevationgetter.js:26:45)</br> at /home/thatcher/node-servers/Moon2STL/moonstlserver.js:51:13</br>

I don't get this error running the same program locally.

node example doesn't work

Hello, the example you put using node didn't work for me, since
fs.readFile(path, function(err, data) {
will return a buffer, and the library needs an arraybuffer.
There are different ways to do the conversion here:
http://stackoverflow.com/questions/8609289/convert-a-binary-nodejs-buffer-to-javascript-arraybuffer

I used this one:

dataArray = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
var tiff = GeoTIFF.parse(dataArray);

Maybe you can change the readme so people can have a working example. (maybe there's an easier solution too)

Please list GDAL as optional dependency to create the other TIFF formats

Whilst running the "setup.sh" Bash script, I noticed that it failed to convert the TIFF files to various formats after download of "initial.tiff" and "rgb.tiff". Upon inspection of the script, it would appear that it requires GDAL to convert.

Therefore, please list GDAL as an optional dependency and direct Windows 10 users to install it in the optional Ubuntu subsystem. Perhaps CygWin would also work.

Error: Cannot find module 'babel-runtime/helpers/possibleConstructorReturn'

I'm using geotiff on a meteor app. I get this error when deploying but not when running on development mode.

The geotiff version I'm using is 1.0.0-beta.6
I'm not using babel-runtime because meteor updated to babel 7 some time ago. So I'm using @babel/runtime 7.1.5. Should I install babel-runtime as well ?

Error: Cannot find module 'babel-runtime/helpers/possibleConstructorReturn'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/built_app/programs/server/npm/node_modules/geotiff/dist/geotiff.js:8:35)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/built_app/programs/server/npm/node_modules/geotiff/dist/main.js:7:16)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at npmRequire (/built_app/programs/server/npm-require.js:133:10)
    at Module.useNode (packages/modules-runtime.js:664:18)

Making more windows dev friendly

Hi there,

I was just wondering if you'd be open to pull request to make this repo a bit more friendly for windows developers.

For example the shell script for setup_data has some calls to wget which isn't windows-friendly, although we could replace this with node-wget script. Even a shell script itself isn't ideal...

Also on clone and npm install I get errors around rm so we could possibly look at something like shelljs.

Any objections?

GeoTIFF only displays once you're very zoomed in

I'm hitting an issue with a GeoTIFF only rendering once you are very zoomed in. As you can see in the image below, one GeoTIFF renders just fine, but the left hand part does not:

screenshot from 2016-12-21 11-39-07

After zooming in (maximum zoom level I believe) and zooming back out you can see the problem correct itself:

screenshot from 2016-12-21 11-41-12

Really struggling to see what might be causing this!

Explore bundling with rollup

Hi there,

Related to #50 I'm wondering if it's worth exploring rollup as a bundling option. Rollup is perhaps a bit more geared towards bundling library code than webpack (which I think is more typically used for bundling applications). Would you mind if I took a look at this?

My motivator is related to #54 (my COG tile server which is coming along nicely) - I've been running into a bunch of weird issues around what is being required etc.

I'm thinking perhaps we could output two builds - 1 targeted for node use, and 1 for browser use.

Anyway if you're interested I'm happy to run some quick explorations and if it's looking feasible put in a pull request.

ENOENT Error when try to run npm test

result after run npm test on terminal.

2 failing

  1. RGB-tests should work with YCbCr files:
    Error: ENOENT: no such file or directory, open 'test/data/ycbcr.tif'

  2. RGB-tests should work with paletted files:
    Error: ENOENT: no such file or directory, open 'test/data/rgb_paletted.tiff'

npm ERR! Test failed. See above for more details.

I have checked the package, and those 2 files are not included

npm ERR! missing script: start

Hi everyone,

I still can't get npm run normally. I've tried so many things. But I keep getting error when I run npm start. This is the error I get when I run npm start.

npm ERR! missing script: start

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/cairo/.npm/_logs/2018-11-22T02_08_49_301Z-debug.log

I tried to put start in package.json as suggested by many

"scripts": {
    "start": "node geotiff.js"
}

but still it doesn't work

Offset is outside the bounds of the DataView

`[Violation] 'setTimeout' handler took 62ms
lzw.js?8b40:17 ran off the end of the buffer before finding EOI_CODE (end on input code)
getByte @ lzw.js?8b40:17
geotiffimage.js?5c03:327 Uncaught (in promise) RangeError: Offset is outside the bounds of the DataView
at DataView.getFloat32 ()
at eval (geotiffimage.js?5c03:327)

source.js?c402:32 Uncaught (in promise) RangeError: Invalid typed array length: -610682
at typedArrayConstructByArrayBuffer ()
at new Uint8Array (native)
at readRangeFromBlocks (webpack-internal:///143:116:23)
at BlockedSource._callee3$ (webpack-internal:///143:454:51)
at tryCatch (webpack-internal:///94:63:40)
at Generator.invoke [as _invoke] (webpack-internal:///94:337:22)
at Generator.prototype.(anonymous function) [as next] (webpack-internal:///94:96:21)
at step (webpack-internal:///29:17:30)
at eval (webpack-internal:///29:28:13)
at
readRangeFromBlocks @ source.js?c402:32
source.js?c402:32 Uncaught (in promise) RangeError: Invalid typed array length: -620184
at typedArrayConstructByArrayBuffer ()
at new Uint8Array (native)
at readRangeFromBlocks (webpack-internal:///143:116:23)
at BlockedSource._callee3$ (webpack-internal:///143:454:51)
at tryCatch (webpack-internal:///94:63:40)
at Generator.invoke [as _invoke] (webpack-internal:///94:337:22)
at Generator.prototype.(anonymous function) [as next] (webpack-internal:///94:96:21)
at step (webpack-internal:///29:17:30)
at eval (webpack-internal:///29:28:13)
at `

how to change band once rendered in OL?

I saw your FOSS4G presentation about geotiff.js/plotty.js and I think it's great what you are doing here! +1

I tried to combine the example where you render a static image in OL and the one where you change the band of a tif.

But how to combine them both? Once my tif is plotted in OL canvas it is not dynamic but static. In the attachment a minimum (not) working example.

mwe_geotiff.zip

WARNING: decode.worker does not have a default export

WARNING in ./node_modules/geotiff/src/pool.js
26:20-26 "export 'default' (imported as 'Worker') was not found in './decoder.worker'
 @ ./node_modules/geotiff/src/pool.js
 @ ./node_modules/geotiff/src/geotiff.js
 @ ./node_modules/geotiff/src/main.js
 ...

Bundling in a react + webpack 4 project, I get this warning.
It appears that nothing is exported from decode.worker.js:
https://github.com/geotiffjs/geotiff.js/blob/master/src/decoder.worker.js#L5

Workaround for chrome bug net::ERR_CACHE_OPERATION_NOT_SUPPORTED

When loading a tiff with DEFLATE compression geotiff.js makes a large number of partial GET requests (around 20 to 30). I assume the content is just distributed that way throughout the file. This seems to be triggering a bug in chrome, where the browser tries to satisfy some of these requests with parts of previous requests, and it fails. Related links:

webtorrent/webtorrent#1193 (comment)
mozilla/pdf.js#9022
https://bugs.chromium.org/p/chromium/issues/detail?id=770694

Would it be possible to implement some sort of work around in geotiff.js? For example, a simple one would be to allow the caller to pass in additional headers that can get added to requests, which could set the no-cache header (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control). Or perhaps implement a retry on a per GET basis to catch this specific error?

extract point data or line profile over the displayed tif

Not really an issue with the js-library as is, but I was wondering if you have any thoughts how to extract a line profile or point once the tif is displayed as a static image through plotty.

You decode the full tif as an array, so the source data is in the memory.

Float32 images with predictors decoded incorrectly

I generated 3 test files from the same source file with:

gdalwarp -t_srs EPSG:4326 -r med -ts 500 0 -co COMPRESS=LZW -co NUM_THREADS=4 -co TILED=YES -co PREDICTOR=1 dsm.tif out_1.tif
gdalwarp -t_srs EPSG:4326 -r med -ts 500 0 -co COMPRESS=LZW -co NUM_THREADS=4 -co TILED=YES -co PREDICTOR=2 dsm.tif out_2.tif
gdalwarp -t_srs EPSG:4326 -r med -ts 500 0 -co COMPRESS=LZW -co NUM_THREADS=4 -co TILED=YES -co PREDICTOR=3 dsm.tif out_3.tif

Output files uploaded here
The files display identically in QGIS.

I wrote a script to decode with this library, and print the first pixel value, a pixel value near the center, the number of pixels with valid data, and the min and max pixel value:

const geotiff = require('geotiff')
const fs = require('fs')
const file = geotiff.parse(fs.readFileSync(process.argv[2]).buffer)
const image = file.getImage(0)
const data = image.readRasters()

console.log(data[0][0], data[0][113476])

let min = Infinity
let max = -Infinity
let count = 0
for (v of data[0]) {
  if (v !== -10000 && !Number.isNaN(v)) { // these files contain value -10000 where the value is undefined
    min = Math.min(min, v)
    max = Math.max(max, v)
    count++
  } 
}

console.log(count, min, max)

For the files encoded using the predictors, the results are incorrect:

$ node test.js ../out_1.tif 
-10000 3.233187437057495
178661 1.7235643863677979 23.675439834594727
$ node test.js ../out_2.tif 
-10000 NaN
3062 -3.0305079947271845e+38 6.5514631170016586e+35
$ node test.js ../out_3.tif 
2.7745709593631378e-43 NaN
89457 -Infinity 6.64613997892458e+35

Remove babel-cli from dependencies

Pretty much as the title says, this package unfortunately pollutes node_modules/.bin/ with an outdated version of babel-cli (it's @babel/node now)

Problem loading bigTIFF larger than 2^32 bytes

We've run into issues loading bigTIFF files that are larger than 2^32 bytes. The issue happens regardless of compression but results in different types of errors. For DEFLATE data we get a 406 HTTP error because the library is requesting an invalid (negative) range. For uncompressed data we get:
RangeError: Offset is outside the bounds of the DataView
or
RangeError: Invalid field type: 615

These might all have the same root cause, which might be related to how 64 bit addresses are handled as 2 x 32 bit values. Do you have any bigTIFF test data that is larger than 2^32 bytes that you can use to reproduce the problem? If not, is there a good way we could send you our test data?

Thanks.

LZW not active

It looks like the lzw compression part was written, but commented out. I un-commented it and tested it on an AsterDEM file and it worked. Is there a reason that it is not turned on ?

Resampling interleaved data hangs browser

When requesting a geotiff with interleave = true, using the readRasters() method, the browser can hang when the data needs to be re-sampled. After some debugging, it appears as though the resampleNearest() and resampleBilinear() methods expect "valueArrays: The input arrays to resample" and don't handle a single interleaved array, which is what they get when interleave = true.

Cannot require dist/geotiff.js

Hi!
We're having problems to use the distribution version of geotiff. Looks like the compiled versions in the dist directory doesn't work with module.exports syntax anymore.
If I require those files, node returns just empty object and for example the parse is not available.

How to reproduce

Open node console and try to require file under dist

[ernoaapa:~]$ node
> require('./node_modules/geotiff/dist/geotiff.js')
{}

Same thing happens with the minified version.

Versions

Geotiff: 0.3.6
Node: 5.10.1, 6.10.0 and 7.7.4

Allowed size of tif file

Hey,

I have an issue parsing the tif image that is greater than ~150MB,
I'm trying with the example you provided.
Node v. 7.5.0

I'm getting this:

<--- Last few GCs --->

[98080:0x102801600] 39024 ms: Mark-sweep 1399.0 (1427.7) -> 1399.0 (1427.7) MB, 4785.4 / 0.0 ms allocation failure GC in old space requested
[98080:0x102801600] 43802 ms: Mark-sweep 1399.0 (1427.7) -> 1399.0 (1426.7) MB, 4620.9 / 0.0 ms last resort gc
[98080:0x102801600] 48518 ms: Mark-sweep 1399.0 (1426.7) -> 1399.0 (1426.7) MB, 4716.0 / 0.0 ms last resort gc

<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x101e70c0d39
1: parseFileDirectories [/Users/maxbudnyk/Projects/crop-vue-api/node_modules/geotiff/src/geotiff.js:~205] [pc=0x3d97e29661c9](this=0x101e70beee9 <a GeoTIFF with map 0x3522a3621269>,byteOffset=136124274)
2: new GeoTIFF [/Users/maxbudnyk/Projects/crop-vue-api/node_modules/geotiff/src/geotiff.js:50] [pc=0x3d97e29572db](this=0x101e70beee9 <a GeoTIFF with map 0x3522a3621269>,rawData=0x101e70b...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [/usr/local/bin/node]
2: node::FatalException(v8::Isolate*, v8::Localv8::Value, v8::Localv8::Message) [/usr/local/bin/node]
3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/local/bin/node]
4: v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/usr/local/bin/node]
5: v8::internal::Runtime_AllocateInTargetSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
6: 0x3d97e2808506
Abort trap: 6

bigTIFF support

Request for bigTIFF support
Reason:
Sentinel-1 SAR data in level-1 TOPS mode are stored as geoTIFF, but the tiff part is using the bigTIFF extension (magic number 43 instead of standard TIFF 42).
geotiff,js is the perfect library for Sentinel-2, and having the possibility to also use it for Sentinel-1 could be a game-changer for Copernicus on the web.

Cannot import geotiff

First thanks for the work done with this library. The code base looks great.

I'm trying to install the module either doing npm install -g geotiff or with the source (as mentioned in the documentation) but still not succeed to import geotiff in my script.

> const GeoTIFF = require('geotiff');
/Users/vincentsarago/.nvm/versions/node/v8.11.2/lib/node_modules/geotiff/src/main.js:1
(function (exports, require, module, __filename, __dirname) { export * from './geotiff';
                                                              ^^^^^^

Is there something obvious I'm missing ?

Thanks

Node version: v8.11.2 (via nvm)

getBoundingBox latitude off?

I was computing the midpoint of my image from the getBoundingBox() and noticed the latitude was always a bit north of my actual image. This may be only specific to my images, but it seems that this is what caused it:

the getOrigin() function gets me the top left (north-west) coordinate of the image. The line
var y2 = y1 + resolution[1] * this.getHeight();
would then always be north of the already north-most coordinate. This is what worked for me: changing the + sign in that code snippet to a negative sign
var y2 = y1 - resolution[1] * this.getHeight();
This is would mean that y2 is now the southern border of the image. This code is from the getBoundingBox() function

1 bit support?

I'm trying to add GeoTiff with 1 bit per sample (black and white) and I'm getting this error:

Uncaught (in promise) Error: Unsupported data format/bitsPerSample
    at arrayForType (geotiffimage.js?5c03:55)
    at GeoTIFFImage._callee3$ (geotiffimage.js?5c03:420)
    at tryCatch (runtime.js?4a57:63)
    at Generator.invoke [as _invoke] (runtime.js?4a57:337)
    at Generator.prototype.(/temp/anonymous function) [as next] (webpack-internal:///93:96:21)
    at step (asyncToGenerator.js?7b11:17)
    at eval (asyncToGenerator.js?7b11:35)
    at new Promise (<anonymous>)
    at new F (_export.js?90cd:35)
    at GeoTIFFImage.eval (asyncToGenerator.js?7b11:14)

Thanks for any reply.

ReferenceError on Node.JS

I tried running the example program for Node just to see how this library works, but it didn't actually run. Here's what I ran:

path = "[path to tif]"
var GeoTIFF = require("geotiff");
var fs = require("fs");

fs.readFile(path, function(err, data) {
  if (err) throw err;
  var tiff = GeoTIFF.parse(data);
  // ...
});

And here's the error I got:

ReferenceError: window is not defined
at Object. (/home/thatcher/Desktop/Projects/node_modules/geotiff/src/globals.js:215:12)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (/home/thatcher/Desktop/Projects/node_modules/geotiff/src/geotiff.js:1:77)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)

From what I can tell, this error has to do with the "window" object being used in the the browser-facing code.

Writing GeoTIFF?

Hi. I have a need for a pure JavaScript library that writes GeoTIFFs. Is that something you see becoming a part of geotiff.js or should such functionality be its own library? Thanks!

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.