Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start making more windows friendly #59

Closed
wants to merge 6 commits into from
Closed
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
21 changes: 10 additions & 11 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"presets": ["env"],
"plugins": [
[
"transform-runtime",
{
"polyfill": false,
"regenerator": true
}
]
]
}
"presets": [[
"@babel/preset-env", {
"modules": false,
"targets": {
"node": true
},
"useBuiltIns": "usage"
}
]]
}
38 changes: 20 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@
"xmldom": "0.1.*"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^7.1.1",
"babel-loader": "^7.1.2",
"babel-plugin-syntax-async-functions": "^6.13.0",
"babel-plugin-transform-async-to-generator": "^6.16.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"benchmark": "^2.1.4",
"chai": "^3.5.0",
"cross-env": "^5.2.0",
"detect-node": "^2.0.3",
"es6-promise": "^4.0.5",
"eslint": "^4.18.0",
Expand All @@ -33,27 +30,32 @@
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.7.0",
"express": "^4.16.3",
"extract-zip": "^1.6.7",
"isomorphic-fetch": "^2.2.1",
"jsdoc": "^3.5.5",
"jsdoc-babel": "^0.2.1",
"jshint-stylish": "^2.2.1",
"mocha": "^3.1.2",
"node-wget": "^0.4.2",
"rollup": "^0.65.0",
"rollup-plugin-babel": "^4.0.2",
"rollup-plugin-butternut": "^0.1.0",
"rollup-plugin-commonjs": "^8.3.0",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-globals": "^1.2.1",
"rollup-plugin-node-resolve": "^3.3.0",
"shelljs": "^0.8.2",
"shx": "^0.3.2",
"webpack": "^3.10.0",
"webpack-dev-server": "^2.11.1",
"worker-loader": "^1.1.1"
},
"scripts": {
"dev": "webpack-dev-server -d -w --content-base test",
"watch": "webpack -d -w",
"build:clean": "rm -rf dist/*",
"bundle:dev": "webpack -d ",
"bundle:prod": "NODE_ENV=production webpack -p",
"build:babel": "babel src/ -d dist",
"build:babel:watch": "babel src/ -d dist -w",
"build": "npm run build:clean ; npm run bundle:dev ; npm run bundle:prod ; npm run build:babel",
"dev": "rollup -c -w",
"build": "rollup -c",
"test": "mocha --compilers js:babel-core/register --require babel-polyfill",
"lint": "eslint src",
"docs": "rm -rf docs/*; jsdoc -c .jsdoc.json -r src README.md -d docs",
"docs": "shx rm -rf docs/* && jsdoc -c .jsdoc.json -r src README.md -d docs",
"prepublish": "npm run build"
},
"author": "Fabian Schindler",
Expand Down
32 changes: 32 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import resolve from 'rollup-plugin-node-resolve'
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import builtins from 'rollup-plugin-node-builtins';
import globals from 'rollup-plugin-node-globals';
import butternut from 'rollup-plugin-butternut';

export default {
input: 'src/main.js',
output: {
file: 'dist/bundle.js',
format: 'umd',
name: 'GeoTIFF',
sourcemap: 'dist/bundle.js.map'
},
watch: {
include: 'src/**',
exclude: ['node_modules/**'],
},
plugins: [
builtins(), // FLags that some of the import statements are NodeJS built-ins
globals(),
resolve(),
commonjs({
include: 'node_modules/**',
}),
babel({
exclude: 'node_modules/**',
include: 'pako/**'
}),
],
}
4 changes: 2 additions & 2 deletions src/decoder.worker.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable no-restricted-globals */

import { getDecoder } from './compression';

function decode(self, fileDirectory, buffer) {
export default function decode(self, fileDirectory, buffer) {
const decoder = getDecoder(fileDirectory);
const result = decoder.decode(fileDirectory, buffer);
self.postMessage([result], [result]);
Expand Down
4 changes: 3 additions & 1 deletion src/source.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { Buffer } from 'buffer';
import { open, read } from 'fs';
import fs from 'fs';
import http from 'http';
import https from 'https';
import urlMod from 'url';

const open = fs.open
const read = fs.read

function readRangeFromBlocks(blocks, rangeOffset, rangeLength) {
const rangeTop = rangeOffset + rangeLength;
Expand Down
61 changes: 61 additions & 0 deletions test/data/setupData.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
const shell = require('shelljs');
const wget = require('node-wget');
var extract = require('extract-zip');

wget({
url: 'https://github.com/EOxServer/autotest/raw/f8d9f4bde6686abbda09c711d4bf5239f5378aa9/autotest/data/meris/MER_FRS_1P_reduced/ENVISAT-MER_FRS_1PNPDE20060816_090929_000001972050_00222_23322_0058_uint16_reduced_compressed.tif',
dest: 'initial.tiff',
});

wget({
url: 'https://github.com/EOxServer/autotest/raw/f8d9f4bde6686abbda09c711d4bf5239f5378aa9/autotest/data/meris/mosaic_MER_FRS_1P_RGB_reduced/mosaic_ENVISAT-MER_FRS_1PNPDE20060816_090929_000001972050_00222_23322_0058_RGB_reduced.tif',
dest: 'rgb.tiff',
});

shell.exec('gdal_translate -of GTiff initial.tiff stripped.tiff');
shell.exec('gdal_translate -of GTiff -co TILED=YES -co BLOCKXSIZE=32 -co BLOCKYSIZE=32 stripped.tiff tiled.tiff');
shell.exec('gdal_translate -of GTiff -ot Int32 stripped.tiff int32.tiff');
shell.exec('gdal_translate -of GTiff -ot UInt32 stripped.tiff uint32.tiff');
shell.exec('gdal_translate -of GTiff -ot Float32 stripped.tiff float32.tiff');
shell.exec('gdal_translate -of GTiff -ot Float64 stripped.tiff float64.tiff');
shell.exec('gdal_translate -of GTiff -co COMPRESS=LZW stripped.tiff lzw.tiff');
shell.exec('gdal_translate -of GTiff -co COMPRESS=DEFLATE stripped.tiff deflate.tiff');
shell.exec('gdal_translate -of GTiff -co COMPRESS=DEFLATE -co PREDICTOR=2 stripped.tiff deflate_predictor.tiff');
shell.exec('gdal_translate -of GTiff -co TILED=YES -co BLOCKXSIZE=32 -co BLOCKYSIZE=32 -co COMPRESS=DEFLATE -co PREDICTOR=2 stripped.tiff deflate_predictor_tiled.tiff');
shell.exec('gdal_translate -of GTiff -co COMPRESS=PACKBITS stripped.tiff packbits.tiff');
shell.exec('gdal_translate -of GTiff -co INTERLEAVE=BAND stripped.tiff interleave.tiff');
shell.exec('gdal_translate -of GTiff -co TILED=YES -co BLOCKXSIZE=32 -co BLOCKYSIZE=32 -co INTERLEAVE=BAND stripped.tiff tiledplanar.tiff');
shell.exec('gdal_translate -of GTiff -co COMPRESS=LZW -co TILED=YES -co BLOCKXSIZE=32 -co BLOCKYSIZE=32 -co INTERLEAVE=BAND stripped.tiff tiledplanarlzw.tiff');
shell.exec('gdal_translate -of GTiff -co COMPRESS=LZW -ot Float64 stripped.tiff float64lzw.tiff');
shell.exec('gdal_translate -of GTiff -co COMPRESS=LZW -co PREDICTOR=2 stripped.tiff lzw_predictor.tiff');
shell.exec('gdal_translate -of GTiff -outsize 10% 10% stripped.tiff small.tiff');
shell.exec('gdal_translate -of GTiff -co BIGTIFF=YES stripped.tiff bigtiff.tiff');


// overviews
shell.cp('stripped.tiff', 'overviews.tiff');
shell.exec('gdaladdo overviews.tiff 2 4 8 16');

// bigtiff
wget('http://www.awaresystems.be/imaging/tiff/bigtiff/BigTIFFSamples.zip');
extract('BigTIFFSamples.zip', {
dir: __dirname,
},
function (err) { //eslint-disable-line
console.log(err);
shell.rm('BigTIFFSamples.zip');
},
);

// color images
shell.exec('rgb2pct.py rgb.tiff rgb_paletted.tiff');
shell.exec('rgb2ycbcr rgb.tiff ycbcr.tif -h 1 -v 1');
shell.exec('convert rgb.tiff -colorspace CMYK cmyk.tif');
shell.exec('convert rgb.tiff -colorspace Lab cielab.tif');

shell.exec('gdal_translate -of GTiff -co COMPRESS=JPEG rgb.tiff jpeg.tiff');
shell.exec('gdal_translate -of GTiff -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR rgb.tiff jpeg_ycbcr.tiff');


// modeltransformation tag
wget('https://s3.amazonaws.com/wdt-external/no_pixelscale_or_tiepoints.tiff');