@deepgis/dem-dynamic-terrain
Version:
使用 GDAL 制作地形瓦片,支持 mapbox 和 terrarium 两种编码输出格式
689 lines (688 loc) • 32.7 kB
JavaScript
import { existsSync } from "node:fs";
import node_os from "node:os";
import emittery from "emittery";
import gdal_async from "gdal-async";
import p_queue from "p-queue";
import tinypool from "tinypool";
import yocto_spinner from "yocto-spinner";
import { randomUUID } from "node:crypto";
import * as __WEBPACK_EXTERNAL_MODULE_commander__ from "commander";
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
import * as __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__ from "node:process";
var __webpack_modules__ = {
"./src/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
__webpack_require__.d(__webpack_exports__, {
G: ()=>TIF2Tiles
});
var promises_ = __webpack_require__("node:fs/promises");
var external_node_path_ = __webpack_require__("node:path");
var package_0 = __webpack_require__("./package.json");
function getBuildOverviewResampling(resampling) {
switch(resampling){
case 1:
return 'AVERAGE';
case 2:
return 'BILINEAR';
case 3:
return 'CUBIC';
case 4:
return 'CUBICSPLINE';
case 5:
return 'LANCZOS';
case 6:
return 'MODE';
case 7:
return 'NEAREST';
default:
return 'CUBIC';
}
}
function getResampling(resampling) {
switch(resampling){
case 1:
return gdal_async.GRA_Average;
case 2:
return gdal_async.GRA_Bilinear;
case 3:
return gdal_async.GRA_Cubic;
case 4:
return gdal_async.GRA_CubicSpline;
case 5:
return gdal_async.GRA_Lanczos;
case 6:
return gdal_async.GRA_Mode;
case 7:
return gdal_async.GRA_NearestNeighbor;
default:
return gdal_async.GRA_Cubic;
}
}
function reprojectImage(src_ds, reproject_path, t_epsg, resampling = 1) {
let s_ds;
s_ds = 'string' == typeof src_ds ? gdal_async.open(src_ds) : src_ds;
const s_srs = s_ds.srs;
const t_srs = gdal_async.SpatialReference.fromEPSGA(t_epsg);
const { rasterSize, geoTransform } = gdal_async.suggestedWarpOutput({
src: s_ds,
s_srs,
t_srs
});
const dataType = s_ds.bands.get(1).dataType;
const t_driver = s_ds.driver;
const t_ds = t_driver.create(reproject_path, rasterSize.x, rasterSize.y, s_ds.bands.count(), dataType);
t_ds.srs = t_srs;
t_ds.geoTransform = geoTransform;
const gdal_resampling = getResampling(resampling);
gdal_async.reprojectImage({
src: s_ds,
dst: t_ds,
s_srs,
t_srs,
resampling: gdal_resampling
});
const bands = s_ds.bands.count();
for(let i = 0; i < bands; i++){
const s_band = s_ds.bands.get(i + 1);
const t_band = t_ds.bands.get(i + 1);
t_band.noDataValue = s_band.noDataValue;
s_band.dataType;
}
t_ds.close();
if ('string' == typeof src_ds) s_ds.close();
}
function createLogger(logger = true) {
const log = (msg)=>{
if (logger) console.log(msg);
};
return {
log
};
}
const tileBoundMap = new Map();
tileBoundMap.set(3857, {
xmin: -20037508.342789244,
ymin: -20037508.342789244,
xmax: 20037508.342789244,
ymax: 20037508.342789244
});
tileBoundMap.set(900913, {
xmin: -20037508.342789244,
ymin: -20037508.342789244,
xmax: 20037508.342789244,
ymax: 20037508.342789244
});
tileBoundMap.set(4490, {
xmin: -180,
ymin: -90,
xmax: 180,
ymax: 90
});
tileBoundMap.set(4326, {
xmin: -180,
ymin: -90,
xmax: 180,
ymax: 90
});
function ST_TileEnvelope(z, x, y, offset = 0, bbox = tileBoundMap.get(3857)) {
const tile_size = 256.0;
const boundsWidth = bbox.xmax - bbox.xmin;
const boundsHeight = bbox.ymax - bbox.ymin;
if (boundsWidth <= 0 || boundsHeight <= 0) throw new Error('Geometric bounds are too small');
if (z < 0 || z >= 32) throw new Error(`Invalid tile zoom value, ${z}`);
const worldTileSize = 0x01 << (z > 31 ? 31 : z);
if (x < 0 || x >= worldTileSize) throw new Error(`Invalid tile x value, ${x}`);
if (y < 0 || y >= worldTileSize) throw new Error(`Invalid tile y value, ${y}`);
const tileGeoSizeX = boundsWidth / worldTileSize;
const tileGeoSizeY = boundsHeight / worldTileSize;
const tileGeoSize = Math.max(tileGeoSizeX, tileGeoSizeY);
const x1 = bbox.xmin + tileGeoSize * x - tileGeoSize / tile_size * offset;
const x2 = bbox.xmin + tileGeoSize * (x + 1) + tileGeoSize / tile_size * offset;
const y1 = bbox.ymax - tileGeoSize * (y + 1) - tileGeoSize / tile_size * offset;
const y2 = bbox.ymax - tileGeoSize * y + tileGeoSize / tile_size * offset;
return [
x1,
y1,
x2,
y2
];
}
function getTileByCoors(coord, zoom, bbox = tileBoundMap.get(3857)) {
const left = bbox.xmin;
const top = bbox.ymax;
const _width = coord[0] - left;
const _height = top - coord[1];
const worldTileSize = 0x01 << zoom;
const boundsWidth = bbox.xmax - bbox.xmin;
const boundsHeight = bbox.ymax - bbox.ymin;
const tileGeoSize = Math.max(boundsWidth, boundsHeight) / worldTileSize;
const row = Math.floor(_height / tileGeoSize);
const column = Math.floor(_width / tileGeoSize);
return {
row,
column
};
}
class TIF2Tiles {
input;
output;
options;
queue;
pool;
log = ()=>{};
sourceDs;
projectDs;
projectPath;
encodePath;
tileBoundTool;
statistics = {
tileCount: 0,
completeCount: 0,
levelInfo: {}
};
id = randomUUID();
emitter = new emittery();
constructor(input, output, options){
this.input = input;
this.output = output;
this.options = options;
this.pool = new tinypool({
filename: this.getWorkerPath(),
runtime: 'child_process'
});
this.queue = new p_queue({
concurrency: node_os.cpus().length,
autoStart: false
});
this.sourceDs = null;
this.projectDs = null;
this.projectPath = null;
this.encodePath = null;
this.tileBoundTool = {
xmin: 0,
ymin: 0,
xmax: 0,
ymax: 0
};
const { log } = createLogger(options.log);
this.log = log;
}
getWorkerPath() {
return new URL('./create-tile.js', import.meta.url).href;
}
async recycle() {
const log = this.log;
if (this.sourceDs) {
try {
this.sourceDs.close();
} catch (e) {
log(e);
}
this.sourceDs = null;
}
if (this.projectDs) {
try {
this.projectDs.close();
} catch (e) {
log(e);
}
this.projectDs = null;
}
if (this.projectPath && existsSync(this.projectPath)) {
await promises_["default"].rm(this.projectPath, {
recursive: true
});
this.projectPath = null;
}
if (this.encodePath && existsSync(this.encodePath)) {
await promises_["default"].rm(this.encodePath, {
recursive: true
});
this.encodePath = null;
}
const ovrPath = `${this.encodePath}.ovr`;
if (existsSync(ovrPath)) await promises_["default"].rm(ovrPath, {
recursive: true
});
}
async reproject(ds, epsg, resampling) {
const projectDatasetPath = external_node_path_["default"].join(node_os.tmpdir(), package_0.KR, `${this.id}.tif`);
await promises_["default"].mkdir(external_node_path_["default"].dirname(projectDatasetPath), {
recursive: true
});
reprojectImage(ds, projectDatasetPath, epsg, resampling);
return projectDatasetPath;
}
buildPyramid(ds, minZoom, resampling) {
const res = ds.geoTransform[1];
const maxPixel = Math.min(ds.rasterSize.x, ds.rasterSize.y);
let overviewNum = 1;
while(maxPixel / 2 ** overviewNum > 256)overviewNum++;
let res_zoom = (this.tileBoundTool.xmax - this.tileBoundTool.xmin) / 256;
let originZ = 0;
while(res_zoom / 2 > res){
res_zoom /= 2;
originZ++;
}
const overviews = [];
for(let zoom = originZ - 1; zoom >= originZ - 1 - overviewNum; zoom--){
if (zoom < minZoom) break;
const factor = 2 ** (originZ - zoom);
overviews.push(factor);
}
const buildOverviewResampling = getBuildOverviewResampling(resampling);
ds.buildOverviews(buildOverviewResampling, overviews);
return {
maxOverViewsZ: originZ - 1,
minOverViewsZ: originZ - overviews.length
};
}
async generateTile() {
const log = this.log;
const { input, output, options } = this;
const type = options.type;
const { minZoom, maxZoom, epsg, encoding, isClean, resampling } = options;
const tileSize = 256;
this.tileBoundTool = tileBoundMap.get(epsg);
const isSavaMbtiles = '.mbtiles' === external_node_path_["default"].extname(output);
let outputDir = output;
if (true === isSavaMbtiles) outputDir = external_node_path_["default"].join(node_os.tmpdir(), this.id);
let stepIndex = 0;
if (isClean) {
if (existsSync(output)) await promises_["default"].rm(output, {
recursive: true
});
await promises_["default"].mkdir(output, {
recursive: true
});
log(`- \u{6B65}\u{9AA4}${++stepIndex}: \u{6E05}\u{7A7A}\u{8F93}\u{51FA}\u{6587}\u{4EF6}\u{5939} - \u{5B8C}\u{6210}`);
}
this.sourceDs = gdal_async.open(input, 'r');
if (this.sourceDs.srs?.getAuthorityCode() !== epsg) {
this.projectPath = await this.reproject(this.sourceDs, epsg, resampling);
this.projectDs = gdal_async.open(this.projectPath, 'r+');
this.sourceDs.close();
log(`- \u{6B65}\u{9AA4}${++stepIndex}: \u{91CD}\u{6295}\u{5F71}\u{81F3} EPSG:${epsg} - \u{5B8C}\u{6210}`);
} else this.projectDs = this.sourceDs;
this.sourceDs = null;
const overViewInfo = this.buildPyramid(this.projectDs, minZoom, resampling);
log(`- \u{6B65}\u{9AA4}${++stepIndex}: \u{6784}\u{5EFA}\u{5F71}\u{50CF}\u{91D1}\u{5B57}\u{5854}\u{7D22}\u{5F15} - \u{5B8C}\u{6210}`);
const projectDs = this.projectDs;
const geoTransform = projectDs.geoTransform;
const dsInfo = {
width: projectDs.rasterSize.x,
height: projectDs.rasterSize.y,
resX: geoTransform[1],
resY: geoTransform[5],
startX: geoTransform[0],
startY: geoTransform[3],
endX: geoTransform[0] + projectDs.rasterSize.x * geoTransform[1],
endY: geoTransform[3] + projectDs.rasterSize.y * geoTransform[5],
path: projectDs.description
};
let tileCount = 0;
let miny;
let maxy;
if (dsInfo.startY < dsInfo.endY) {
miny = dsInfo.startY;
maxy = dsInfo.endY;
} else {
miny = dsInfo.endY;
maxy = dsInfo.startY;
}
const startPoint = [
dsInfo.startX,
maxy
];
const endPoint = [
dsInfo.endX,
miny
];
for(let tz = minZoom; tz <= maxZoom; ++tz){
const minRC = getTileByCoors(startPoint, tz, this.tileBoundTool);
const maxRC = getTileByCoors(endPoint, tz, this.tileBoundTool);
this.statistics.tileCount += (maxRC.row - minRC.row + 1) * (maxRC.column - minRC.column + 1);
this.statistics.levelInfo[tz] = {
tminx: minRC.column,
tminy: minRC.row,
tmaxx: maxRC.column,
tmaxy: maxRC.row
};
}
const buffer = 1;
let outTileSize = tileSize;
if ('mapbox' === encoding) outTileSize = tileSize + 2 * buffer;
if ('dom' === type) outTileSize = tileSize;
let spinner;
spinner = options.log ? yocto_spinner({
text: `\u{6B65}\u{9AA4}${++stepIndex}: \u{5F00}\u{59CB}\u{51C6}\u{5907}\u{5207}\u{7247}\u{961F}\u{5217} - \u{5B8C}\u{6210}`
}).start() : {
text: '',
error: ()=>{},
success: ()=>{}
};
const queue = this.queue;
const jobs = [];
queue.on('completed', (result)=>{
jobs.push(result);
const percent = Math.floor(jobs.length / tileCount * 100);
spinner.text = `\u{5207}\u{7247}\u{8FDB}\u{5EA6}: ${percent}%`;
this.emitter.emit('completed', {
id: this.id,
tileCount,
createTileCount: jobs.length
});
});
queue.on('idle', async ()=>{
if (jobs.length !== tileCount) spinner.error(`\u{6B65}\u{9AA4}${++stepIndex}: \u{5207}\u{7247} - \u{5931}\u{8D25}`);
if (jobs.length === tileCount) spinner.success(`\u{6B65}\u{9AA4}${++stepIndex}: \u{5207}\u{7247} - \u{5B8C}\u{6210}`);
this.resetStats();
await this.pool.destroy();
await this.recycle();
this.emitter.emit('idle', {
id: this.id,
tileCount,
createTileCount: jobs.length
});
});
for(let tz = minZoom; tz <= maxZoom; tz++){
const { tminx, tminy, tmaxx, tmaxy } = this.statistics.levelInfo[tz];
let overviewInfo;
if (tz > overViewInfo.maxOverViewsZ) overviewInfo = dsInfo;
else {
const startZ = Math.max(tz, overViewInfo.minOverViewsZ);
const factorZoom = overViewInfo.maxOverViewsZ - startZ;
const factor = 2 ** (factorZoom + 1);
overviewInfo = {
index: factorZoom,
startX: dsInfo.startX,
startY: dsInfo.startY,
width: Math.ceil(dsInfo.width / factor),
height: Math.ceil(dsInfo.height / factor),
resX: dsInfo.resX * factor,
resY: dsInfo.resY * factor
};
}
for(let j = tminx; j <= tmaxx; j++){
await promises_["default"].mkdir(external_node_path_["default"].join(outputDir, tz.toString(), j.toString()), {
recursive: true
});
for(let i = tminy; i <= tmaxy; i++){
const tileBound = ST_TileEnvelope(tz, j, i, buffer, this.tileBoundTool);
const { rb, wb } = geoQuery(overviewInfo, tileBound[0], tileBound[3], tileBound[2], tileBound[1], outTileSize);
const createInfo = {
outTileSize,
overviewInfo,
rb,
wb,
encoding,
dsPath: dsInfo.path,
x: j,
y: i,
z: tz,
outputTile: outputDir,
type
};
tileCount++;
queue.add(()=>this.pool.run(createInfo));
}
}
}
log(`
- \u{6B65}\u{9AA4}${++stepIndex}: \u{751F}\u{6210}\u{5207}\u{7247}\u{4EFB}\u{52A1}\u{961F}\u{5217}: ${tileCount} - \u{5B8C}\u{6210}`);
queue.start();
}
resetStats() {
this.statistics.tileCount = 0;
this.statistics.completeCount = 0;
this.statistics.levelInfo = {};
}
}
function geoQuery(overviewInfo, ulx, uly, lrx, lry, querysize = 0) {
const { startX, startY, width, height, resX, resY } = overviewInfo;
let rx = Math.floor((ulx - startX) / resX + 0.001);
let ry = Math.floor((uly - startY) / resY + 0.001);
let rxsize = Math.max(1, Math.floor((lrx - ulx) / resX + 0.5));
let rysize = Math.max(1, Math.floor((lry - uly) / resY + 0.5));
let wxsize, wysize;
if (querysize) {
wxsize = querysize;
wysize = querysize;
} else {
wxsize = rxsize;
wysize = rysize;
}
let wx = 0;
if (rx < 0) {
const rxshift = Math.abs(rx);
wx = Math.floor(rxshift / rxsize * wxsize);
wxsize -= wx;
rxsize -= Math.floor(rxshift / rxsize * rxsize);
rx = 0;
}
if (rx + rxsize > width) {
wxsize = Math.floor(wxsize * (width - rx) * 1.0 / rxsize);
rxsize = width - rx;
}
let wy = 0;
if (ry < 0) {
const ryshift = Math.abs(ry);
wy = Math.floor(ryshift / rysize * wysize);
wysize -= wy;
rysize -= Math.floor(ryshift / rysize * rysize);
ry = 0;
}
if (ry + rysize > height) {
wysize = Math.floor(wysize * (height - ry) * 1.0 / rysize);
rysize = height - ry;
}
return {
rb: {
rx,
ry,
rxsize,
rysize
},
wb: {
wx,
wy,
wxsize,
wysize
}
};
}
},
"./src/cli.ts": function(module, __webpack_exports__, __webpack_require__) {
__webpack_require__.a(module, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
try {
__webpack_require__.r(__webpack_exports__);
var node_fs_promises__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:fs/promises");
var node_path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("node:path");
var node_process__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("node:process");
var commander__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("commander");
var _package_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./package.json");
var _index__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./src/index.ts");
const version = _package_json__WEBPACK_IMPORTED_MODULE_4__.i8;
commander__WEBPACK_IMPORTED_MODULE_3__.program.name(_package_json__WEBPACK_IMPORTED_MODULE_4__.u2).description("\u4F7F\u7528 GDAL \u5236\u4F5C\u5730\u5F62\u74E6\u7247\uFF0C\u652F\u6301 mapbox \u548C terrarium \u4E24\u79CD\u7F16\u7801\u8F93\u51FA\u683C\u5F0F\uFF0C\u5F53\u524D\u4EC5\u8F93\u51FA PNG \u56FE\u7247\u683C\u5F0F\u3002").version(version, '-v, --version', "\u5F53\u524D\u7248\u672C").helpOption('-h, --help', "\u5E2E\u52A9");
commander__WEBPACK_IMPORTED_MODULE_3__.program.option('-i, --input <string>', "<\u5FC5\u586B> \u8F93\u5165 tif \u683C\u5F0F\u7684 DEM \u6587\u4EF6\u8DEF\u5F84\uFF0C\u652F\u6301\u76F8\u5BF9\u8DEF\u5F84").option('-o, --output <string>', "<\u5FC5\u586B> \u8F93\u51FA\u76EE\u5F55\uFF0C\u652F\u6301\u76F8\u5BF9\u8DEF\u5F84").option('-t, --type <string>', "<\u5FC5\u586B> \u5207\u7247\u7C7B\u578B, terrain \u6216 dom", 'terrain').option('-f, --configFile <File>', "<\u53EF\u9009> \u901A\u8FC7\u914D\u7F6E\u6587\u4EF6\u6267\u884C\u4EFB\u52A1\uFF0C\u8F93\u5165\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u53EF\u53C2\u8003\u914D\u7F6E\u6A21\u677F").option('-r, --resampling <number>', `<\u{53EF}\u{9009}> \u{6784}\u{5EFA}\u{5F71}\u{50CF}\u{91D1}\u{5B57}\u{5854}\u{6216}\u{91CD}\u{6295}\u{5F71}\u{65F6}\u{8BBE}\u{7F6E}\u{91CD}\u{91C7}\u{6837}\u{7B56}\u{7565}, \u{9ED8}\u{8BA4}3, 1:AVERAGE|
2:BILINEAR|3:CUBIC|
4:CUBICSPLINE|5:LANCZOS|
6:MODE|7:NEAREST`, '3').option('-g, --epsg <number>', "<\u53EF\u9009> Tile\u9002\u7528\u5750\u6807\u7CFB, 3857 | 4490 | 4326", '3857').option('-c, --clean', "<\u53EF\u9009> \u662F\u5426\u6E05\u7A7A\u8F93\u51FA\u76EE\u5F55", false).option('-z, --zoom <number-number>', "<\u53EF\u9009> \u6307\u5B9A\u74E6\u7247\u7684\u7B49\u7EA7\u751F\u6210\u8303\u56F4\u3002\u4F8B\u5982\uFF0C\u60F3\u751F\u6210 7 ~ 12 \u7EA7\u7684\u74E6\u7247\uFF0C\u5219\u8F93\u5165 -z 7-12", '5-14').option('-e, --encoding <string>', "<\u53EF\u9009> \u6307\u5B9A\u74E6\u7247\u7684\u6570\u636E\u7F16\u7801\u89C4\u5219(mapbox \u6216 terrarium)", 'mapbox').option('-b, --baseHeight <number>', "<\u53EF\u9009> \u57FA\u51C6\u9AD8\u5EA6, \u9ED8\u8BA40", '0');
commander__WEBPACK_IMPORTED_MODULE_3__.program.parse();
const options = commander__WEBPACK_IMPORTED_MODULE_3__.program.opts();
let params;
params = options.configFile ? JSON.parse(await node_fs_promises__WEBPACK_IMPORTED_MODULE_0__["default"].readFile(options.configFile, 'utf-8')) : options;
const type = params.type;
const inputDem = params.input;
const outputDir = params.output;
if (void 0 === inputDem || void 0 === outputDir) {
console.log("\u53C2\u6570\u7F3A\u5931: \u8F93\u5165\u6587\u4EF6\u8DEF\u5F84\u6216\u8F93\u51FA\u76EE\u5F55\u5FC5\u586B");
node_process__WEBPACK_IMPORTED_MODULE_2__["default"].exit();
}
const encoding = params.encoding;
const epsg = Number(params.epsg);
const isClean = params.clean;
let baseHeight = Number(params.baseHeight);
if (Number.isNaN(baseHeight)) baseHeight = 0;
let zoom = params.zoom;
zoom = zoom.split('-');
const minZoom = Number(zoom[0]);
const maxZoom = Number(zoom[1]);
if (Number.isNaN(minZoom) || Number.isNaN(maxZoom)) {
console.log(`\u{53C2}\u{6570} -zoom: ${zoom} \u{9519}\u{8BEF}\u{FF0C}\u{5E94}\u{4E3A}\u{6574}\u{6570}`);
node_process__WEBPACK_IMPORTED_MODULE_2__["default"].exit();
}
if (minZoom >= maxZoom) {
console.log(`\u{53C2}\u{6570} -zoom: ${zoom} \u{9519}\u{8BEF}\u{FF1A}\u{6700}\u{5C0F}\u{7EA7}\u{522B}: ${minZoom} \u{5E94}\u{5C0F}\u{4E8E}\u{6700}\u{5927}\u{7EA7}\u{522B}: ${maxZoom}`);
node_process__WEBPACK_IMPORTED_MODULE_2__["default"].exit();
}
const inputAbsolutePath = node_path__WEBPACK_IMPORTED_MODULE_1__["default"].isAbsolute(inputDem) ? inputDem : node_path__WEBPACK_IMPORTED_MODULE_1__["default"].resolve(node_process__WEBPACK_IMPORTED_MODULE_2__["default"].cwd(), inputDem);
const outFileAbsolutePath = node_path__WEBPACK_IMPORTED_MODULE_1__["default"].isAbsolute(outputDir) ? outputDir : node_path__WEBPACK_IMPORTED_MODULE_1__["default"].resolve(node_process__WEBPACK_IMPORTED_MODULE_2__["default"].cwd(), outputDir);
const logMsg = `
>> \u{5F00}\u{59CB}\u{8F6C}\u{6362}...
- \u{8F93}\u{5165}\u{6587}\u{4EF6}: ${inputAbsolutePath}
- \u{8F93}\u{51FA}\u{8DEF}\u{5F84}: ${outFileAbsolutePath}
- Tile\u{9002}\u{7528}\u{5750}\u{6807}\u{7CFB}: EPSG:${epsg}
- \u{74E6}\u{7247}\u{7F16}\u{7801}: ${'mapbox' === encoding ? 'mapbox(raster-dem)' : encoding}
- \u{74E6}\u{7247}\u{5C3A}\u{5BF8}: 256 px
- \u{74E6}\u{7247}\u{7B49}\u{7EA7}: ${minZoom} \u{81F3} ${maxZoom} \u{7EA7}
- \u{57FA}\u{51C6}\u{9AD8}\u{5EA6}: ${baseHeight}
- \u{5207}\u{7247}\u{7C7B}\u{578B}: ${type}
`;
console.log(logMsg);
const args = {
minZoom,
maxZoom,
epsg,
encoding,
isClean,
baseHeight,
resampling: params.resampling,
type,
log: true
};
const tif2Tiles = new _index__WEBPACK_IMPORTED_MODULE_5__.G(inputDem, outputDir, args);
await tif2Tiles.generateTile();
__webpack_async_result__();
} catch (e) {
__webpack_async_result__(e);
}
}, 1);
},
commander: function(module) {
module.exports = __WEBPACK_EXTERNAL_MODULE_commander__;
},
"node:fs/promises": function(module) {
module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__;
},
"node:path": function(module) {
module.exports = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__;
},
"node:process": function(module) {
module.exports = __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__;
},
"./package.json": function(module) {
module.exports = JSON.parse('{"u2":"@deepgis/dem-dynamic-terrain","i8":"0.0.4","KR":"dem-dynamic-terrain"}');
}
};
var __webpack_module_cache__ = {};
function __webpack_require__(moduleId) {
var cachedModule = __webpack_module_cache__[moduleId];
if (void 0 !== cachedModule) return cachedModule.exports;
var module = __webpack_module_cache__[moduleId] = {
exports: {}
};
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
return module.exports;
}
(()=>{
var webpackQueues = "function" == typeof Symbol ? Symbol("webpack queues") : "__webpack_queues__";
var webpackExports = "function" == typeof Symbol ? Symbol("webpack exports") : "__webpack_exports__";
var webpackError = "function" == typeof Symbol ? Symbol("webpack error") : "__webpack_error__";
var resolveQueue = (queue)=>{
if (queue && queue.d < 1) {
queue.d = 1;
queue.forEach((fn)=>fn.r--);
queue.forEach((fn)=>fn.r-- ? fn.r++ : fn());
}
};
var wrapDeps = (deps)=>deps.map((dep)=>{
if (null !== dep && "object" == typeof dep) {
if (dep[webpackQueues]) return dep;
if (dep.then) {
var queue = [];
queue.d = 0;
dep.then((r)=>{
obj[webpackExports] = r;
resolveQueue(queue);
}, (e)=>{
obj[webpackError] = e;
resolveQueue(queue);
});
var obj = {};
obj[webpackQueues] = (fn)=>fn(queue);
return obj;
}
}
var ret = {};
ret[webpackQueues] = function() {};
ret[webpackExports] = dep;
return ret;
});
__webpack_require__.a = (module, body, hasAwait)=>{
var queue;
hasAwait && ((queue = []).d = -1);
var depQueues = new Set();
var exports = module.exports;
var currentDeps;
var outerResolve;
var reject;
var promise = new Promise((resolve, rej)=>{
reject = rej;
outerResolve = resolve;
});
promise[webpackExports] = exports;
promise[webpackQueues] = (fn)=>{
queue && fn(queue), depQueues.forEach(fn), promise["catch"](function() {});
};
module.exports = promise;
body((deps)=>{
currentDeps = wrapDeps(deps);
var fn;
var getResult = ()=>currentDeps.map((d)=>{
if (d[webpackError]) throw d[webpackError];
return d[webpackExports];
});
var promise = new Promise((resolve)=>{
fn = ()=>resolve(getResult);
fn.r = 0;
var fnQueue = (q)=>q !== queue && !depQueues.has(q) && (depQueues.add(q), q && !q.d && (fn.r++, q.push(fn)));
currentDeps.map((dep)=>dep[webpackQueues](fnQueue));
});
return fn.r ? promise : getResult();
}, (err)=>(err ? reject(promise[webpackError] = err) : outerResolve(exports), resolveQueue(queue)));
queue && queue.d < 0 && (queue.d = 0);
};
})();
(()=>{
__webpack_require__.d = (exports, definition)=>{
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
enumerable: true,
get: definition[key]
});
};
})();
(()=>{
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
__webpack_require__.r = (exports)=>{
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
value: 'Module'
});
Object.defineProperty(exports, '__esModule', {
value: true
});
};
})();
__webpack_require__("./src/cli.ts");