@basemaps/lambda-tiler 6.41.0 → 6.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/build/__tests__/index.test.js +17 -5
- package/build/__tests__/index.test.js.map +1 -1
- package/build/cli/render.preview.d.ts +2 -0
- package/build/cli/render.preview.d.ts.map +1 -0
- package/build/cli/render.preview.js +38 -0
- package/build/cli/render.preview.js.map +1 -0
- package/build/cli/render.tile.js +25 -10
- package/build/cli/render.tile.js.map +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +6 -0
- package/build/index.js.map +1 -1
- package/build/routes/__tests__/preview.index.test.d.ts +2 -0
- package/build/routes/__tests__/preview.index.test.d.ts.map +1 -0
- package/build/routes/__tests__/preview.index.test.js +82 -0
- package/build/routes/__tests__/preview.index.test.js.map +1 -0
- package/build/routes/attribution.d.ts.map +1 -1
- package/build/routes/attribution.js +1 -3
- package/build/routes/attribution.js.map +1 -1
- package/build/routes/preview.d.ts +58 -0
- package/build/routes/preview.d.ts.map +1 -0
- package/build/routes/preview.index.d.ts +23 -0
- package/build/routes/preview.index.d.ts.map +1 -0
- package/build/routes/preview.index.js +98 -0
- package/build/routes/preview.index.js.map +1 -0
- package/build/routes/preview.js +159 -0
- package/build/routes/preview.js.map +1 -0
- package/build/routes/tile.xyz.raster.d.ts +15 -0
- package/build/routes/tile.xyz.raster.d.ts.map +1 -1
- package/build/routes/tile.xyz.raster.js +45 -26
- package/build/routes/tile.xyz.raster.js.map +1 -1
- package/build/routes/version.d.ts.map +1 -1
- package/build/routes/version.js +17 -1
- package/build/routes/version.js.map +1 -1
- package/build/util/validate.d.ts +3 -1
- package/build/util/validate.d.ts.map +1 -1
- package/build/util/validate.js +10 -0
- package/build/util/validate.js.map +1 -1
- package/bundle.sh +1 -1
- package/package.json +9 -9
- package/src/__tests__/index.test.ts +20 -5
- package/src/cli/render.preview.ts +44 -0
- package/src/cli/render.tile.ts +26 -10
- package/src/index.ts +7 -0
- package/src/routes/__tests__/preview.index.test.ts +94 -0
- package/src/routes/attribution.ts +1 -3
- package/src/routes/preview.index.ts +119 -0
- package/src/routes/preview.ts +234 -0
- package/src/routes/tile.xyz.raster.ts +53 -29
- package/src/routes/version.ts +17 -1
- package/src/util/validate.ts +10 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/index.js +0 -229
- package/dist/node_modules/.package-lock.json +0 -491
- package/dist/node_modules/base64-js/LICENSE +0 -21
- package/dist/node_modules/base64-js/README.md +0 -34
- package/dist/node_modules/base64-js/base64js.min.js +0 -1
- package/dist/node_modules/base64-js/index.d.ts +0 -3
- package/dist/node_modules/base64-js/index.js +0 -150
- package/dist/node_modules/base64-js/package.json +0 -47
- package/dist/node_modules/bl/.travis.yml +0 -17
- package/dist/node_modules/bl/BufferList.js +0 -396
- package/dist/node_modules/bl/LICENSE.md +0 -13
- package/dist/node_modules/bl/README.md +0 -247
- package/dist/node_modules/bl/bl.js +0 -84
- package/dist/node_modules/bl/package.json +0 -37
- package/dist/node_modules/bl/test/convert.js +0 -21
- package/dist/node_modules/bl/test/indexOf.js +0 -492
- package/dist/node_modules/bl/test/isBufferList.js +0 -32
- package/dist/node_modules/bl/test/test.js +0 -869
- package/dist/node_modules/buffer/AUTHORS.md +0 -70
- package/dist/node_modules/buffer/LICENSE +0 -21
- package/dist/node_modules/buffer/README.md +0 -410
- package/dist/node_modules/buffer/index.d.ts +0 -186
- package/dist/node_modules/buffer/index.js +0 -1817
- package/dist/node_modules/buffer/package.json +0 -96
- package/dist/node_modules/chownr/LICENSE +0 -15
- package/dist/node_modules/chownr/README.md +0 -3
- package/dist/node_modules/chownr/chownr.js +0 -167
- package/dist/node_modules/chownr/package.json +0 -29
- package/dist/node_modules/color/LICENSE +0 -21
- package/dist/node_modules/color/README.md +0 -123
- package/dist/node_modules/color/index.js +0 -496
- package/dist/node_modules/color/package.json +0 -47
- package/dist/node_modules/color-convert/CHANGELOG.md +0 -54
- package/dist/node_modules/color-convert/LICENSE +0 -21
- package/dist/node_modules/color-convert/README.md +0 -68
- package/dist/node_modules/color-convert/conversions.js +0 -839
- package/dist/node_modules/color-convert/index.js +0 -81
- package/dist/node_modules/color-convert/package.json +0 -48
- package/dist/node_modules/color-convert/route.js +0 -97
- package/dist/node_modules/color-name/LICENSE +0 -8
- package/dist/node_modules/color-name/README.md +0 -11
- package/dist/node_modules/color-name/index.js +0 -152
- package/dist/node_modules/color-name/package.json +0 -28
- package/dist/node_modules/color-string/LICENSE +0 -21
- package/dist/node_modules/color-string/README.md +0 -62
- package/dist/node_modules/color-string/index.js +0 -242
- package/dist/node_modules/color-string/package.json +0 -39
- package/dist/node_modules/decompress-response/index.d.ts +0 -22
- package/dist/node_modules/decompress-response/index.js +0 -58
- package/dist/node_modules/decompress-response/license +0 -9
- package/dist/node_modules/decompress-response/package.json +0 -56
- package/dist/node_modules/decompress-response/readme.md +0 -48
- package/dist/node_modules/deep-extend/CHANGELOG.md +0 -46
- package/dist/node_modules/deep-extend/LICENSE +0 -20
- package/dist/node_modules/deep-extend/README.md +0 -91
- package/dist/node_modules/deep-extend/index.js +0 -1
- package/dist/node_modules/deep-extend/lib/deep-extend.js +0 -150
- package/dist/node_modules/deep-extend/package.json +0 -62
- package/dist/node_modules/detect-libc/LICENSE +0 -201
- package/dist/node_modules/detect-libc/README.md +0 -163
- package/dist/node_modules/detect-libc/index.d.ts +0 -14
- package/dist/node_modules/detect-libc/lib/detect-libc.js +0 -279
- package/dist/node_modules/detect-libc/lib/filesystem.js +0 -41
- package/dist/node_modules/detect-libc/lib/process.js +0 -19
- package/dist/node_modules/detect-libc/package.json +0 -40
- package/dist/node_modules/end-of-stream/LICENSE +0 -21
- package/dist/node_modules/end-of-stream/README.md +0 -54
- package/dist/node_modules/end-of-stream/index.js +0 -94
- package/dist/node_modules/end-of-stream/package.json +0 -37
- package/dist/node_modules/expand-template/.travis.yml +0 -6
- package/dist/node_modules/expand-template/LICENSE +0 -21
- package/dist/node_modules/expand-template/README.md +0 -43
- package/dist/node_modules/expand-template/index.js +0 -26
- package/dist/node_modules/expand-template/package.json +0 -29
- package/dist/node_modules/expand-template/test.js +0 -67
- package/dist/node_modules/fs-constants/LICENSE +0 -21
- package/dist/node_modules/fs-constants/README.md +0 -26
- package/dist/node_modules/fs-constants/browser.js +0 -1
- package/dist/node_modules/fs-constants/index.js +0 -1
- package/dist/node_modules/fs-constants/package.json +0 -19
- package/dist/node_modules/github-from-package/.travis.yml +0 -4
- package/dist/node_modules/github-from-package/LICENSE +0 -18
- package/dist/node_modules/github-from-package/example/package.json +0 -8
- package/dist/node_modules/github-from-package/example/url.js +0 -3
- package/dist/node_modules/github-from-package/index.js +0 -17
- package/dist/node_modules/github-from-package/package.json +0 -30
- package/dist/node_modules/github-from-package/readme.markdown +0 -53
- package/dist/node_modules/github-from-package/test/a.json +0 -8
- package/dist/node_modules/github-from-package/test/b.json +0 -5
- package/dist/node_modules/github-from-package/test/c.json +0 -5
- package/dist/node_modules/github-from-package/test/d.json +0 -7
- package/dist/node_modules/github-from-package/test/e.json +0 -5
- package/dist/node_modules/github-from-package/test/url.js +0 -19
- package/dist/node_modules/ieee754/LICENSE +0 -11
- package/dist/node_modules/ieee754/README.md +0 -51
- package/dist/node_modules/ieee754/index.d.ts +0 -10
- package/dist/node_modules/ieee754/index.js +0 -85
- package/dist/node_modules/ieee754/package.json +0 -52
- package/dist/node_modules/inherits/LICENSE +0 -16
- package/dist/node_modules/inherits/README.md +0 -42
- package/dist/node_modules/inherits/inherits.js +0 -9
- package/dist/node_modules/inherits/inherits_browser.js +0 -27
- package/dist/node_modules/inherits/package.json +0 -29
- package/dist/node_modules/ini/LICENSE +0 -15
- package/dist/node_modules/ini/README.md +0 -102
- package/dist/node_modules/ini/ini.js +0 -206
- package/dist/node_modules/ini/package.json +0 -33
- package/dist/node_modules/is-arrayish/LICENSE +0 -21
- package/dist/node_modules/is-arrayish/README.md +0 -16
- package/dist/node_modules/is-arrayish/index.js +0 -9
- package/dist/node_modules/is-arrayish/package.json +0 -45
- package/dist/node_modules/is-arrayish/yarn-error.log +0 -1443
- package/dist/node_modules/lru-cache/LICENSE +0 -15
- package/dist/node_modules/lru-cache/README.md +0 -166
- package/dist/node_modules/lru-cache/index.js +0 -334
- package/dist/node_modules/lru-cache/package.json +0 -34
- package/dist/node_modules/mimic-response/index.d.ts +0 -17
- package/dist/node_modules/mimic-response/index.js +0 -77
- package/dist/node_modules/mimic-response/license +0 -9
- package/dist/node_modules/mimic-response/package.json +0 -42
- package/dist/node_modules/mimic-response/readme.md +0 -78
- package/dist/node_modules/minimist/.eslintrc +0 -29
- package/dist/node_modules/minimist/.github/FUNDING.yml +0 -12
- package/dist/node_modules/minimist/.nycrc +0 -14
- package/dist/node_modules/minimist/CHANGELOG.md +0 -298
- package/dist/node_modules/minimist/LICENSE +0 -18
- package/dist/node_modules/minimist/README.md +0 -121
- package/dist/node_modules/minimist/example/parse.js +0 -4
- package/dist/node_modules/minimist/index.js +0 -263
- package/dist/node_modules/minimist/package.json +0 -75
- package/dist/node_modules/minimist/test/all_bool.js +0 -34
- package/dist/node_modules/minimist/test/bool.js +0 -177
- package/dist/node_modules/minimist/test/dash.js +0 -43
- package/dist/node_modules/minimist/test/default_bool.js +0 -37
- package/dist/node_modules/minimist/test/dotted.js +0 -24
- package/dist/node_modules/minimist/test/kv_short.js +0 -32
- package/dist/node_modules/minimist/test/long.js +0 -33
- package/dist/node_modules/minimist/test/num.js +0 -38
- package/dist/node_modules/minimist/test/parse.js +0 -209
- package/dist/node_modules/minimist/test/parse_modified.js +0 -11
- package/dist/node_modules/minimist/test/proto.js +0 -64
- package/dist/node_modules/minimist/test/short.js +0 -69
- package/dist/node_modules/minimist/test/stop_early.js +0 -17
- package/dist/node_modules/minimist/test/unknown.js +0 -104
- package/dist/node_modules/minimist/test/whitespace.js +0 -10
- package/dist/node_modules/mkdirp-classic/LICENSE +0 -21
- package/dist/node_modules/mkdirp-classic/README.md +0 -18
- package/dist/node_modules/mkdirp-classic/index.js +0 -98
- package/dist/node_modules/mkdirp-classic/package.json +0 -18
- package/dist/node_modules/napi-build-utils/LICENSE +0 -21
- package/dist/node_modules/napi-build-utils/README.md +0 -48
- package/dist/node_modules/napi-build-utils/index.js +0 -213
- package/dist/node_modules/napi-build-utils/index.md +0 -81
- package/dist/node_modules/napi-build-utils/package.json +0 -41
- package/dist/node_modules/node-abi/.circleci/config.yml +0 -45
- package/dist/node_modules/node-abi/.github/CODEOWNERS +0 -1
- package/dist/node_modules/node-abi/.github/workflows/semantic.yml +0 -26
- package/dist/node_modules/node-abi/.github/workflows/update-abi.yml +0 -42
- package/dist/node_modules/node-abi/.releaserc.json +0 -9
- package/dist/node_modules/node-abi/CODE_OF_CONDUCT.md +0 -73
- package/dist/node_modules/node-abi/CONTRIBUTING.md +0 -62
- package/dist/node_modules/node-abi/LICENSE +0 -21
- package/dist/node_modules/node-abi/README.md +0 -52
- package/dist/node_modules/node-abi/abi_registry.json +0 -269
- package/dist/node_modules/node-abi/index.js +0 -179
- package/dist/node_modules/node-abi/package.json +0 -38
- package/dist/node_modules/node-abi/scripts/update-abi-registry.js +0 -119
- package/dist/node_modules/node-abi/test/index.js +0 -166
- package/dist/node_modules/node-addon-api/LICENSE.md +0 -13
- package/dist/node_modules/node-addon-api/README.md +0 -317
- package/dist/node_modules/node-addon-api/common.gypi +0 -21
- package/dist/node_modules/node-addon-api/except.gypi +0 -25
- package/dist/node_modules/node-addon-api/index.js +0 -11
- package/dist/node_modules/node-addon-api/napi-inl.deprecated.h +0 -186
- package/dist/node_modules/node-addon-api/napi-inl.h +0 -6303
- package/dist/node_modules/node-addon-api/napi.h +0 -3114
- package/dist/node_modules/node-addon-api/node_api.gyp +0 -9
- package/dist/node_modules/node-addon-api/noexcept.gypi +0 -26
- package/dist/node_modules/node-addon-api/nothing.c +0 -0
- package/dist/node_modules/node-addon-api/package-support.json +0 -21
- package/dist/node_modules/node-addon-api/package.json +0 -456
- package/dist/node_modules/node-addon-api/tools/README.md +0 -73
- package/dist/node_modules/node-addon-api/tools/check-napi.js +0 -99
- package/dist/node_modules/node-addon-api/tools/clang-format.js +0 -71
- package/dist/node_modules/node-addon-api/tools/conversion.js +0 -301
- package/dist/node_modules/node-addon-api/tools/eslint-format.js +0 -79
- package/dist/node_modules/once/LICENSE +0 -15
- package/dist/node_modules/once/README.md +0 -79
- package/dist/node_modules/once/once.js +0 -42
- package/dist/node_modules/once/package.json +0 -33
- package/dist/node_modules/prebuild-install/CHANGELOG.md +0 -116
- package/dist/node_modules/prebuild-install/CONTRIBUTING.md +0 -6
- package/dist/node_modules/prebuild-install/LICENSE +0 -21
- package/dist/node_modules/prebuild-install/README.md +0 -163
- package/dist/node_modules/prebuild-install/asset.js +0 -44
- package/dist/node_modules/prebuild-install/bin.js +0 -78
- package/dist/node_modules/prebuild-install/download.js +0 -142
- package/dist/node_modules/prebuild-install/error.js +0 -14
- package/dist/node_modules/prebuild-install/help.txt +0 -16
- package/dist/node_modules/prebuild-install/index.js +0 -1
- package/dist/node_modules/prebuild-install/log.js +0 -33
- package/dist/node_modules/prebuild-install/package.json +0 -67
- package/dist/node_modules/prebuild-install/proxy.js +0 -35
- package/dist/node_modules/prebuild-install/rc.js +0 -64
- package/dist/node_modules/prebuild-install/util.js +0 -143
- package/dist/node_modules/pump/.travis.yml +0 -5
- package/dist/node_modules/pump/LICENSE +0 -21
- package/dist/node_modules/pump/README.md +0 -65
- package/dist/node_modules/pump/index.js +0 -82
- package/dist/node_modules/pump/package.json +0 -24
- package/dist/node_modules/pump/test-browser.js +0 -66
- package/dist/node_modules/pump/test-node.js +0 -53
- package/dist/node_modules/rc/LICENSE.APACHE2 +0 -15
- package/dist/node_modules/rc/LICENSE.BSD +0 -26
- package/dist/node_modules/rc/LICENSE.MIT +0 -24
- package/dist/node_modules/rc/README.md +0 -227
- package/dist/node_modules/rc/browser.js +0 -7
- package/dist/node_modules/rc/cli.js +0 -4
- package/dist/node_modules/rc/index.js +0 -53
- package/dist/node_modules/rc/lib/utils.js +0 -104
- package/dist/node_modules/rc/package.json +0 -29
- package/dist/node_modules/rc/test/ini.js +0 -16
- package/dist/node_modules/rc/test/nested-env-vars.js +0 -50
- package/dist/node_modules/rc/test/test.js +0 -59
- package/dist/node_modules/readable-stream/CONTRIBUTING.md +0 -38
- package/dist/node_modules/readable-stream/GOVERNANCE.md +0 -136
- package/dist/node_modules/readable-stream/LICENSE +0 -47
- package/dist/node_modules/readable-stream/README.md +0 -106
- package/dist/node_modules/readable-stream/errors-browser.js +0 -127
- package/dist/node_modules/readable-stream/errors.js +0 -116
- package/dist/node_modules/readable-stream/experimentalWarning.js +0 -17
- package/dist/node_modules/readable-stream/lib/_stream_duplex.js +0 -126
- package/dist/node_modules/readable-stream/lib/_stream_passthrough.js +0 -37
- package/dist/node_modules/readable-stream/lib/_stream_readable.js +0 -1027
- package/dist/node_modules/readable-stream/lib/_stream_transform.js +0 -190
- package/dist/node_modules/readable-stream/lib/_stream_writable.js +0 -641
- package/dist/node_modules/readable-stream/lib/internal/streams/async_iterator.js +0 -180
- package/dist/node_modules/readable-stream/lib/internal/streams/buffer_list.js +0 -183
- package/dist/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -96
- package/dist/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +0 -86
- package/dist/node_modules/readable-stream/lib/internal/streams/from-browser.js +0 -3
- package/dist/node_modules/readable-stream/lib/internal/streams/from.js +0 -52
- package/dist/node_modules/readable-stream/lib/internal/streams/pipeline.js +0 -86
- package/dist/node_modules/readable-stream/lib/internal/streams/state.js +0 -22
- package/dist/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
- package/dist/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
- package/dist/node_modules/readable-stream/package.json +0 -68
- package/dist/node_modules/readable-stream/readable-browser.js +0 -9
- package/dist/node_modules/readable-stream/readable.js +0 -16
- package/dist/node_modules/safe-buffer/LICENSE +0 -21
- package/dist/node_modules/safe-buffer/README.md +0 -584
- package/dist/node_modules/safe-buffer/index.d.ts +0 -187
- package/dist/node_modules/safe-buffer/index.js +0 -65
- package/dist/node_modules/safe-buffer/package.json +0 -51
- package/dist/node_modules/semver/LICENSE +0 -15
- package/dist/node_modules/semver/README.md +0 -637
- package/dist/node_modules/semver/bin/semver.js +0 -197
- package/dist/node_modules/semver/classes/comparator.js +0 -141
- package/dist/node_modules/semver/classes/index.js +0 -5
- package/dist/node_modules/semver/classes/range.js +0 -539
- package/dist/node_modules/semver/classes/semver.js +0 -302
- package/dist/node_modules/semver/functions/clean.js +0 -6
- package/dist/node_modules/semver/functions/cmp.js +0 -52
- package/dist/node_modules/semver/functions/coerce.js +0 -52
- package/dist/node_modules/semver/functions/compare-build.js +0 -7
- package/dist/node_modules/semver/functions/compare-loose.js +0 -3
- package/dist/node_modules/semver/functions/compare.js +0 -5
- package/dist/node_modules/semver/functions/diff.js +0 -65
- package/dist/node_modules/semver/functions/eq.js +0 -3
- package/dist/node_modules/semver/functions/gt.js +0 -3
- package/dist/node_modules/semver/functions/gte.js +0 -3
- package/dist/node_modules/semver/functions/inc.js +0 -19
- package/dist/node_modules/semver/functions/lt.js +0 -3
- package/dist/node_modules/semver/functions/lte.js +0 -3
- package/dist/node_modules/semver/functions/major.js +0 -3
- package/dist/node_modules/semver/functions/minor.js +0 -3
- package/dist/node_modules/semver/functions/neq.js +0 -3
- package/dist/node_modules/semver/functions/parse.js +0 -16
- package/dist/node_modules/semver/functions/patch.js +0 -3
- package/dist/node_modules/semver/functions/prerelease.js +0 -6
- package/dist/node_modules/semver/functions/rcompare.js +0 -3
- package/dist/node_modules/semver/functions/rsort.js +0 -3
- package/dist/node_modules/semver/functions/satisfies.js +0 -10
- package/dist/node_modules/semver/functions/sort.js +0 -3
- package/dist/node_modules/semver/functions/valid.js +0 -6
- package/dist/node_modules/semver/index.js +0 -89
- package/dist/node_modules/semver/internal/constants.js +0 -35
- package/dist/node_modules/semver/internal/debug.js +0 -9
- package/dist/node_modules/semver/internal/identifiers.js +0 -23
- package/dist/node_modules/semver/internal/parse-options.js +0 -15
- package/dist/node_modules/semver/internal/re.js +0 -212
- package/dist/node_modules/semver/package.json +0 -87
- package/dist/node_modules/semver/preload.js +0 -2
- package/dist/node_modules/semver/range.bnf +0 -16
- package/dist/node_modules/semver/ranges/gtr.js +0 -4
- package/dist/node_modules/semver/ranges/intersects.js +0 -7
- package/dist/node_modules/semver/ranges/ltr.js +0 -4
- package/dist/node_modules/semver/ranges/max-satisfying.js +0 -25
- package/dist/node_modules/semver/ranges/min-satisfying.js +0 -24
- package/dist/node_modules/semver/ranges/min-version.js +0 -61
- package/dist/node_modules/semver/ranges/outside.js +0 -80
- package/dist/node_modules/semver/ranges/simplify.js +0 -47
- package/dist/node_modules/semver/ranges/subset.js +0 -247
- package/dist/node_modules/semver/ranges/to-comparators.js +0 -8
- package/dist/node_modules/semver/ranges/valid.js +0 -11
- package/dist/node_modules/sharp/LICENSE +0 -191
- package/dist/node_modules/sharp/README.md +0 -117
- package/dist/node_modules/sharp/binding.gyp +0 -233
- package/dist/node_modules/sharp/build/Release/sharp-linux-x64.node +0 -0
- package/dist/node_modules/sharp/install/can-compile.js +0 -11
- package/dist/node_modules/sharp/install/dll-copy.js +0 -37
- package/dist/node_modules/sharp/install/libvips.js +0 -215
- package/dist/node_modules/sharp/lib/agent.js +0 -40
- package/dist/node_modules/sharp/lib/channel.js +0 -171
- package/dist/node_modules/sharp/lib/colour.js +0 -180
- package/dist/node_modules/sharp/lib/composite.js +0 -193
- package/dist/node_modules/sharp/lib/constructor.js +0 -386
- package/dist/node_modules/sharp/lib/index.js +0 -13
- package/dist/node_modules/sharp/lib/input.js +0 -507
- package/dist/node_modules/sharp/lib/is.js +0 -143
- package/dist/node_modules/sharp/lib/libvips.js +0 -136
- package/dist/node_modules/sharp/lib/operation.js +0 -803
- package/dist/node_modules/sharp/lib/output.js +0 -1231
- package/dist/node_modules/sharp/lib/platform.js +0 -27
- package/dist/node_modules/sharp/lib/resize.js +0 -473
- package/dist/node_modules/sharp/lib/sharp.js +0 -35
- package/dist/node_modules/sharp/lib/utility.js +0 -211
- package/dist/node_modules/sharp/package.json +0 -196
- package/dist/node_modules/sharp/src/common.cc +0 -966
- package/dist/node_modules/sharp/src/common.h +0 -352
- package/dist/node_modules/sharp/src/libvips/cplusplus/VConnection.cpp +0 -152
- package/dist/node_modules/sharp/src/libvips/cplusplus/VError.cpp +0 -50
- package/dist/node_modules/sharp/src/libvips/cplusplus/VImage.cpp +0 -1523
- package/dist/node_modules/sharp/src/libvips/cplusplus/VInterpolate.cpp +0 -63
- package/dist/node_modules/sharp/src/libvips/cplusplus/vips-operators.cpp +0 -3738
- package/dist/node_modules/sharp/src/metadata.cc +0 -291
- package/dist/node_modules/sharp/src/metadata.h +0 -92
- package/dist/node_modules/sharp/src/operations.cc +0 -412
- package/dist/node_modules/sharp/src/operations.h +0 -126
- package/dist/node_modules/sharp/src/pipeline.cc +0 -1624
- package/dist/node_modules/sharp/src/pipeline.h +0 -349
- package/dist/node_modules/sharp/src/sharp.cc +0 -52
- package/dist/node_modules/sharp/src/stats.cc +0 -193
- package/dist/node_modules/sharp/src/stats.h +0 -70
- package/dist/node_modules/sharp/src/utilities.cc +0 -243
- package/dist/node_modules/sharp/src/utilities.h +0 -29
- package/dist/node_modules/sharp/vendor/8.12.2/linux-x64/THIRD-PARTY-NOTICES.md +0 -43
- package/dist/node_modules/sharp/vendor/8.12.2/linux-x64/lib/libvips-cpp.so.42 +0 -0
- package/dist/node_modules/sharp/vendor/8.12.2/linux-x64/platform.json +0 -1
- package/dist/node_modules/sharp/vendor/8.12.2/linux-x64/versions.json +0 -31
- package/dist/node_modules/simple-concat/.travis.yml +0 -3
- package/dist/node_modules/simple-concat/LICENSE +0 -20
- package/dist/node_modules/simple-concat/README.md +0 -44
- package/dist/node_modules/simple-concat/index.js +0 -15
- package/dist/node_modules/simple-concat/package.json +0 -47
- package/dist/node_modules/simple-concat/test/basic.js +0 -41
- package/dist/node_modules/simple-get/.github/dependabot.yml +0 -15
- package/dist/node_modules/simple-get/.github/workflows/ci.yml +0 -23
- package/dist/node_modules/simple-get/LICENSE +0 -20
- package/dist/node_modules/simple-get/README.md +0 -333
- package/dist/node_modules/simple-get/index.js +0 -108
- package/dist/node_modules/simple-get/package.json +0 -67
- package/dist/node_modules/simple-swizzle/LICENSE +0 -21
- package/dist/node_modules/simple-swizzle/README.md +0 -39
- package/dist/node_modules/simple-swizzle/index.js +0 -29
- package/dist/node_modules/simple-swizzle/package.json +0 -36
- package/dist/node_modules/string_decoder/LICENSE +0 -48
- package/dist/node_modules/string_decoder/README.md +0 -47
- package/dist/node_modules/string_decoder/lib/string_decoder.js +0 -296
- package/dist/node_modules/string_decoder/package.json +0 -34
- package/dist/node_modules/strip-json-comments/index.js +0 -70
- package/dist/node_modules/strip-json-comments/license +0 -21
- package/dist/node_modules/strip-json-comments/package.json +0 -42
- package/dist/node_modules/strip-json-comments/readme.md +0 -64
- package/dist/node_modules/tar-fs/.travis.yml +0 -6
- package/dist/node_modules/tar-fs/LICENSE +0 -21
- package/dist/node_modules/tar-fs/README.md +0 -165
- package/dist/node_modules/tar-fs/index.js +0 -351
- package/dist/node_modules/tar-fs/package.json +0 -41
- package/dist/node_modules/tar-fs/test/fixtures/a/hello.txt +0 -1
- package/dist/node_modules/tar-fs/test/fixtures/b/a/test.txt +0 -1
- package/dist/node_modules/tar-fs/test/fixtures/d/file1 +0 -0
- package/dist/node_modules/tar-fs/test/fixtures/d/file2 +0 -0
- package/dist/node_modules/tar-fs/test/fixtures/d/sub-dir/file5 +0 -0
- package/dist/node_modules/tar-fs/test/fixtures/d/sub-files/file3 +0 -0
- package/dist/node_modules/tar-fs/test/fixtures/d/sub-files/file4 +0 -0
- package/dist/node_modules/tar-fs/test/fixtures/e/directory/.ignore +0 -0
- package/dist/node_modules/tar-fs/test/fixtures/e/file +0 -0
- package/dist/node_modules/tar-fs/test/fixtures/invalid.tar +0 -0
- package/dist/node_modules/tar-fs/test/index.js +0 -346
- package/dist/node_modules/tar-stream/LICENSE +0 -21
- package/dist/node_modules/tar-stream/README.md +0 -168
- package/dist/node_modules/tar-stream/extract.js +0 -257
- package/dist/node_modules/tar-stream/headers.js +0 -295
- package/dist/node_modules/tar-stream/index.js +0 -2
- package/dist/node_modules/tar-stream/pack.js +0 -255
- package/dist/node_modules/tar-stream/package.json +0 -58
- package/dist/node_modules/tar-stream/sandbox.js +0 -11
- package/dist/node_modules/tunnel-agent/LICENSE +0 -55
- package/dist/node_modules/tunnel-agent/README.md +0 -4
- package/dist/node_modules/tunnel-agent/index.js +0 -244
- package/dist/node_modules/tunnel-agent/package.json +0 -22
- package/dist/node_modules/util-deprecate/History.md +0 -16
- package/dist/node_modules/util-deprecate/LICENSE +0 -24
- package/dist/node_modules/util-deprecate/README.md +0 -53
- package/dist/node_modules/util-deprecate/browser.js +0 -67
- package/dist/node_modules/util-deprecate/node.js +0 -6
- package/dist/node_modules/util-deprecate/package.json +0 -27
- package/dist/node_modules/wrappy/LICENSE +0 -15
- package/dist/node_modules/wrappy/README.md +0 -36
- package/dist/node_modules/wrappy/package.json +0 -29
- package/dist/node_modules/wrappy/wrappy.js +0 -33
- package/dist/node_modules/yallist/LICENSE +0 -15
- package/dist/node_modules/yallist/README.md +0 -204
- package/dist/node_modules/yallist/iterator.js +0 -8
- package/dist/node_modules/yallist/package.json +0 -29
- package/dist/node_modules/yallist/yallist.js +0 -426
- package/dist/package-lock.json +0 -502
- package/dist/package.json +0 -38
- package/dist/static/expected_tile_2193_153_255_z7.png +0 -0
- package/dist/static/expected_tile_NZTM2000Quad_30_33_z6.png +0 -0
- package/dist/static/expected_tile_WebMercatorQuad_252_156_z8.png +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { Bounds, ImageFormat, Projection } from '@basemaps/geo';
|
|
2
|
+
import { Tiler } from '@basemaps/tiler';
|
|
3
|
+
import { TileMakerSharp } from '@basemaps/tiler-sharp';
|
|
4
|
+
import { HttpHeader, LambdaHttpResponse } from '@linzjs/lambda';
|
|
5
|
+
import { ConfigLoader } from '../util/config.loader.js';
|
|
6
|
+
import { Etag } from '../util/etag.js';
|
|
7
|
+
import { NotModified } from '../util/response.js';
|
|
8
|
+
import { Validate } from '../util/validate.js';
|
|
9
|
+
import { DefaultResizeKernel, TileXyzRaster, isArchiveTiff } from './tile.xyz.raster.js';
|
|
10
|
+
import sharp from 'sharp';
|
|
11
|
+
const PreviewSize = { width: 1200, height: 630 };
|
|
12
|
+
const TilerSharp = new TileMakerSharp(PreviewSize.width, PreviewSize.height);
|
|
13
|
+
const OutputFormat = ImageFormat.Webp;
|
|
14
|
+
/** Slightly grey color for the checker background */
|
|
15
|
+
const PreviewBackgroundFillColor = 0xef;
|
|
16
|
+
/** Make th e checkered background 30x30px */
|
|
17
|
+
const PreviewBackgroundSizePx = 30;
|
|
18
|
+
/**
|
|
19
|
+
* Serve a preview of a imagery set
|
|
20
|
+
*
|
|
21
|
+
* /v1/preview/:tileSet/:tileMatrixSet/:z/:lon/:lat
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* Raster Tile `/v1/preview/aerial/WebMercatorQuad/12/177.3998405/-39.0852555`
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
export async function tilePreviewGet(req) {
|
|
28
|
+
const tileMatrix = Validate.getTileMatrixSet(req.params.tileMatrix);
|
|
29
|
+
if (tileMatrix == null)
|
|
30
|
+
return new LambdaHttpResponse(404, 'Tile Matrix not found');
|
|
31
|
+
req.set('tileMatrix', tileMatrix.identifier);
|
|
32
|
+
req.set('projection', tileMatrix.projection.code);
|
|
33
|
+
// TODO we should detect the format based off the "Accept" header and maybe default back to webp
|
|
34
|
+
req.set('extension', OutputFormat);
|
|
35
|
+
const location = Validate.getLocation(req.params.lon, req.params.lat);
|
|
36
|
+
if (location == null)
|
|
37
|
+
return new LambdaHttpResponse(404, 'Preview location not found');
|
|
38
|
+
req.set('location', location);
|
|
39
|
+
const z = Math.ceil(parseFloat(req.params.z));
|
|
40
|
+
if (isNaN(z) || z < 0 || z > tileMatrix.maxZoom)
|
|
41
|
+
return new LambdaHttpResponse(404, 'Preview zoom invalid');
|
|
42
|
+
const config = await ConfigLoader.load(req);
|
|
43
|
+
req.timer.start('tileset:load');
|
|
44
|
+
const tileSet = await config.TileSet.get(config.TileSet.id(req.params.tileSet));
|
|
45
|
+
req.timer.end('tileset:load');
|
|
46
|
+
if (tileSet == null)
|
|
47
|
+
return new LambdaHttpResponse(404, 'Tileset not found');
|
|
48
|
+
// Only raster previews are supported
|
|
49
|
+
if (tileSet.type !== 'raster')
|
|
50
|
+
return new LambdaHttpResponse(404, 'Preview invalid tile set type');
|
|
51
|
+
return renderPreview(req, { tileSet, tileMatrix, location, outputFormat: OutputFormat, z });
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Render the preview!
|
|
55
|
+
*
|
|
56
|
+
* All the parameter validation is done in {@link tilePreviewGet} this function expects everything to align
|
|
57
|
+
*
|
|
58
|
+
* @returns 304 not modified if the ETag matches or 200 ok with the content of the image
|
|
59
|
+
*/
|
|
60
|
+
export async function renderPreview(req, ctx) {
|
|
61
|
+
const tileMatrix = ctx.tileMatrix;
|
|
62
|
+
// Convert the input lat/lon into the projected coordinates to make it easier to do math with
|
|
63
|
+
const coords = Projection.get(tileMatrix).fromWgs84([ctx.location.lon, ctx.location.lat]);
|
|
64
|
+
// use the input as the center point, but round it to the closest pixel to make it easier to do math
|
|
65
|
+
const point = tileMatrix.sourceToPixels(coords[0], coords[1], ctx.z);
|
|
66
|
+
const pointCenter = { x: Math.round(point.x), y: Math.round(point.y) };
|
|
67
|
+
// position of the preview in relation to the output screen
|
|
68
|
+
const screenBounds = new Bounds(pointCenter.x - PreviewSize.width / 2, pointCenter.y - PreviewSize.height / 2, PreviewSize.width, PreviewSize.height);
|
|
69
|
+
// Convert the screen bounds back into the source to find the assets we need to render the preview
|
|
70
|
+
const topLeft = tileMatrix.pixelsToSource(screenBounds.x, screenBounds.y, ctx.z);
|
|
71
|
+
const bottomRight = tileMatrix.pixelsToSource(screenBounds.right, screenBounds.bottom, ctx.z);
|
|
72
|
+
const sourceBounds = Bounds.fromBbox([topLeft.x, topLeft.y, bottomRight.x, bottomRight.y]);
|
|
73
|
+
const assetLocations = await TileXyzRaster.getAssetsForBounds(req, ctx.tileSet, tileMatrix, sourceBounds, ctx.z, true);
|
|
74
|
+
const cacheKey = Etag.key(assetLocations);
|
|
75
|
+
if (Etag.isNotModified(req, cacheKey))
|
|
76
|
+
return NotModified();
|
|
77
|
+
const assets = await TileXyzRaster.loadAssets(req, assetLocations);
|
|
78
|
+
const tiler = new Tiler(tileMatrix);
|
|
79
|
+
// Figure out what tiffs and tiles need to be read and where they are placed on the output image
|
|
80
|
+
const compositions = [];
|
|
81
|
+
for (const asset of assets) {
|
|
82
|
+
// there shouldn't be any Cotar archives in previews but ignore them to be safe
|
|
83
|
+
if (!isArchiveTiff(asset))
|
|
84
|
+
continue;
|
|
85
|
+
const result = tiler.getTiles(asset, screenBounds, ctx.z);
|
|
86
|
+
if (result == null)
|
|
87
|
+
continue;
|
|
88
|
+
compositions.push(...result);
|
|
89
|
+
}
|
|
90
|
+
// Load all the tiff tiles and resize/them into the correct locations
|
|
91
|
+
req.timer.start('compose:overlay');
|
|
92
|
+
const overlays = (await Promise.all(compositions.map((comp) => TilerSharp.composeTileTiff(comp, DefaultResizeKernel))).then((items) => items.filter((f) => f != null)));
|
|
93
|
+
req.timer.end('compose:overlay');
|
|
94
|
+
// Create the output image and render all the individual pieces into them
|
|
95
|
+
const img = getBaseImage(ctx.tileSet.background);
|
|
96
|
+
img.composite(overlays);
|
|
97
|
+
req.timer.start('compose:compress');
|
|
98
|
+
const buf = await TilerSharp.toImage(ctx.outputFormat, img);
|
|
99
|
+
req.timer.end('compose:compress');
|
|
100
|
+
req.set('layersUsed', overlays.length);
|
|
101
|
+
req.set('bytes', buf.byteLength);
|
|
102
|
+
const response = new LambdaHttpResponse(200, 'ok');
|
|
103
|
+
response.header(HttpHeader.ETag, cacheKey);
|
|
104
|
+
response.header(HttpHeader.CacheControl, 'public, max-age=604800, stale-while-revalidate=86400');
|
|
105
|
+
response.buffer(buf, 'image/' + ctx.outputFormat);
|
|
106
|
+
const shortLocation = [ctx.location.lon.toFixed(7), ctx.location.lat.toFixed(7)].join('_');
|
|
107
|
+
const suggestedFileName = `preview_${ctx.tileSet.name}_z${ctx.z}_${shortLocation}.${ctx.outputFormat}`;
|
|
108
|
+
response.header('Content-Disposition', `inline; filename=\"${suggestedFileName}\"`);
|
|
109
|
+
return response;
|
|
110
|
+
}
|
|
111
|
+
function getBaseImage(bg) {
|
|
112
|
+
if (bg == null || bg.alpha === 0) {
|
|
113
|
+
const buf = createCheckerBoard({
|
|
114
|
+
width: PreviewSize.width,
|
|
115
|
+
height: PreviewSize.height,
|
|
116
|
+
colors: { fill: PreviewBackgroundFillColor, background: 0xff },
|
|
117
|
+
size: PreviewBackgroundSizePx,
|
|
118
|
+
});
|
|
119
|
+
return sharp(buf.buffer, { raw: buf.raw });
|
|
120
|
+
}
|
|
121
|
+
return TilerSharp.createImage(bg);
|
|
122
|
+
}
|
|
123
|
+
/** Create a chess/checkerboard background alternating between two colors */
|
|
124
|
+
function createCheckerBoard(ctx) {
|
|
125
|
+
const { width, height, size } = ctx;
|
|
126
|
+
const fillColor = ctx.colors.fill;
|
|
127
|
+
// Create a one band image, which starts off as full white
|
|
128
|
+
const buf = Buffer.alloc(height * width, ctx.colors.background); // 1 band grey buffer;
|
|
129
|
+
// Number of squares to make in x/y directions
|
|
130
|
+
const tileY = height / size;
|
|
131
|
+
const tileX = width / size;
|
|
132
|
+
// Fill in a square at the x/y pixel offsets
|
|
133
|
+
function fillSquare(xOffset, yOffset) {
|
|
134
|
+
for (let y = 0; y < size; y++) {
|
|
135
|
+
const yPx = (yOffset + y) * width;
|
|
136
|
+
for (let x = 0; x < size; x++) {
|
|
137
|
+
const px = yPx + xOffset + x;
|
|
138
|
+
// Actually set the color
|
|
139
|
+
buf[px] = fillColor;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
for (let tX = 0; tX < tileX; tX++) {
|
|
144
|
+
for (let tY = 0; tY < tileY; tY++) {
|
|
145
|
+
const yOffset = tY * size;
|
|
146
|
+
const y2 = tY % 2;
|
|
147
|
+
// Draw every second tile alternating on rows
|
|
148
|
+
const x2 = tX % 2;
|
|
149
|
+
if (x2 === 0 && y2 === 1)
|
|
150
|
+
continue;
|
|
151
|
+
if (x2 === 1 && y2 === 0)
|
|
152
|
+
continue;
|
|
153
|
+
const xOffset = tX * size;
|
|
154
|
+
fillSquare(xOffset, yOffset);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return { buffer: buf, raw: { width, height, channels: 1 } };
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../src/routes/preview.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAU,UAAU,EAAiB,MAAM,eAAe,CAAC;AACvF,OAAO,EAAmB,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAgB,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,UAAU,EAAqB,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,MAAM,WAAW,GAAG,EAAE,KAAK,E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E,GAAG,KAAK,EAAE,EAAE,EAAE,EAAE;QACjC,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,EAAE;YACjC,MAAM,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC;YAC1B,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;YAElB,6CAA6C;YAC7C,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;YAClB,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;gBAAE,SAAS;YACnC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;gBAAE,SAAS;YAEnC,MAAM,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC;YAC1B,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;SAC9B;KACF;IAED,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;AAC9D,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConfigTileSetRaster } from '@basemaps/config';
|
|
2
|
+
import { Bounds, TileMatrixSet } from '@basemaps/geo';
|
|
2
3
|
import { TileMakerSharp } from '@basemaps/tiler-sharp';
|
|
3
4
|
import { CogTiff } from '@cogeotiff/core';
|
|
4
5
|
import { Cotar } from '@cotar/core';
|
|
@@ -6,8 +7,22 @@ import { LambdaHttpRequest, LambdaHttpResponse } from '@linzjs/lambda';
|
|
|
6
7
|
import { TileXyz } from '../util/validate.js';
|
|
7
8
|
export declare function getTiffName(name: string): string;
|
|
8
9
|
export type CloudArchive = CogTiff | Cotar;
|
|
10
|
+
/** Check to see if a cloud archive is a Tiff or a Cotar */
|
|
11
|
+
export declare function isArchiveTiff(x: CloudArchive): x is CogTiff;
|
|
9
12
|
export declare const TileComposer: TileMakerSharp;
|
|
13
|
+
export declare const DefaultResizeKernel: {
|
|
14
|
+
readonly in: "lanczos3";
|
|
15
|
+
readonly out: "lanczos3";
|
|
16
|
+
};
|
|
17
|
+
export declare const DefaultBackground: {
|
|
18
|
+
r: number;
|
|
19
|
+
g: number;
|
|
20
|
+
b: number;
|
|
21
|
+
alpha: number;
|
|
22
|
+
};
|
|
10
23
|
export declare const TileXyzRaster: {
|
|
24
|
+
getAssetsForBounds(req: LambdaHttpRequest, tileSet: ConfigTileSetRaster, tileMatrix: TileMatrixSet, bounds: Bounds, zoom: number, ignoreOverview?: boolean): Promise<string[]>;
|
|
25
|
+
loadAssets(req: LambdaHttpRequest, assets: string[]): Promise<CloudArchive[]>;
|
|
11
26
|
getAssetsForTile(req: LambdaHttpRequest, tileSet: ConfigTileSetRaster, xyz: TileXyz): Promise<string[]>;
|
|
12
27
|
tile(req: LambdaHttpRequest, tileSet: ConfigTileSetRaster, xyz: TileXyz): Promise<LambdaHttpResponse>;
|
|
13
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile.xyz.raster.d.ts","sourceRoot":"","sources":["../../src/routes/tile.xyz.raster.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"tile.xyz.raster.d.ts","sourceRoot":"","sources":["../../src/routes/tile.xyz.raster.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,MAAM,EAAQ,aAAa,EAAgC,MAAM,eAAe,CAAC;AAG1F,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAc,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAOnF,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAI9C,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIhD;AAED,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,KAAK,CAAC;AAE3C,2DAA2D;AAC3D,wBAAgB,aAAa,CAAC,CAAC,EAAE,YAAY,GAAG,CAAC,IAAI,OAAO,CAK3D;AAED,eAAO,MAAM,YAAY,gBAA0B,CAAC;AAEpD,eAAO,MAAM,mBAAmB;;;CAA+C,CAAC;AAChF,eAAO,MAAM,iBAAiB;;;;;CAAiC,CAAC;AAEhE,eAAO,MAAM,aAAa;4BAEjB,iBAAiB,WACb,mBAAmB,cAChB,aAAa,UACjB,MAAM,QACR,MAAM,6BAEX,QAAQ,MAAM,EAAE,CAAC;oBA8CE,iBAAiB,UAAU,MAAM,EAAE,GAAG,QAAQ,YAAY,EAAE,CAAC;0BAsBvD,iBAAiB,WAAW,mBAAmB,OAAO,OAAO,GAAG,QAAQ,MAAM,EAAE,CAAC;cAK7F,iBAAiB,WAAW,mBAAmB,OAAO,OAAO,GAAG,QAAQ,kBAAkB,CAAC;CA6B5G,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { Bounds, Epsg, TileMatrixSet, TileMatrixSets, VectorFormat } from '@base
|
|
|
3
3
|
import { Env, fsa } from '@basemaps/shared';
|
|
4
4
|
import { Tiler } from '@basemaps/tiler';
|
|
5
5
|
import { TileMakerSharp } from '@basemaps/tiler-sharp';
|
|
6
|
+
import { CogTiff } from '@cogeotiff/core';
|
|
6
7
|
import { HttpHeader, LambdaHttpResponse } from '@linzjs/lambda';
|
|
7
8
|
import pLimit from 'p-limit';
|
|
8
9
|
import { ConfigLoader } from '../util/config.loader.js';
|
|
@@ -17,41 +18,52 @@ export function getTiffName(name) {
|
|
|
17
18
|
return name;
|
|
18
19
|
return `${name}.tiff`;
|
|
19
20
|
}
|
|
21
|
+
/** Check to see if a cloud archive is a Tiff or a Cotar */
|
|
22
|
+
export function isArchiveTiff(x) {
|
|
23
|
+
if (x instanceof CogTiff)
|
|
24
|
+
return true;
|
|
25
|
+
if (x.source.uri.endsWith('.tiff'))
|
|
26
|
+
return true;
|
|
27
|
+
if (x.source.uri.endsWith('.tif'))
|
|
28
|
+
return true;
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
20
31
|
export const TileComposer = new TileMakerSharp(256);
|
|
21
|
-
const DefaultResizeKernel = { in: 'lanczos3', out: 'lanczos3' };
|
|
22
|
-
const DefaultBackground = { r: 0, g: 0, b: 0, alpha: 0 };
|
|
32
|
+
export const DefaultResizeKernel = { in: 'lanczos3', out: 'lanczos3' };
|
|
33
|
+
export const DefaultBackground = { r: 0, g: 0, b: 0, alpha: 0 };
|
|
23
34
|
export const TileXyzRaster = {
|
|
24
|
-
async
|
|
35
|
+
async getAssetsForBounds(req, tileSet, tileMatrix, bounds, zoom, ignoreOverview = false) {
|
|
25
36
|
const config = await ConfigLoader.load(req);
|
|
26
|
-
const imagery = await getAllImagery(config, tileSet.layers, [
|
|
37
|
+
const imagery = await getAllImagery(config, tileSet.layers, [tileMatrix.projection]);
|
|
27
38
|
const filteredLayers = filterLayers(req, tileSet.layers);
|
|
28
39
|
const output = [];
|
|
29
|
-
const tileBounds = xyz.tileMatrix.tileToSourceBounds(xyz.tile);
|
|
30
40
|
// All zoom level config is stored as Google zoom levels
|
|
31
|
-
const filterZoom = TileMatrixSet.convertZoomLevel(
|
|
41
|
+
const filterZoom = TileMatrixSet.convertZoomLevel(zoom, tileMatrix, TileMatrixSets.get(Epsg.Google));
|
|
32
42
|
for (const layer of filteredLayers) {
|
|
33
|
-
if (layer.disabled)
|
|
34
|
-
continue;
|
|
35
43
|
if (layer.maxZoom != null && filterZoom > layer.maxZoom)
|
|
36
44
|
continue;
|
|
37
45
|
if (layer.minZoom != null && filterZoom < layer.minZoom)
|
|
38
46
|
continue;
|
|
39
|
-
const imgId = layer[
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
const imgId = layer[tileMatrix.projection.code];
|
|
48
|
+
// Imagery does not exist for this projection
|
|
49
|
+
if (imgId == null)
|
|
42
50
|
continue;
|
|
43
|
-
}
|
|
44
51
|
const img = imagery.get(imgId);
|
|
45
52
|
if (img == null) {
|
|
46
|
-
req.log.warn({ layer: layer.name, projection:
|
|
53
|
+
req.log.warn({ layer: layer.name, projection: tileMatrix.projection.code, imgId }, 'Failed to lookup imagery');
|
|
47
54
|
continue;
|
|
48
55
|
}
|
|
49
|
-
if (!
|
|
56
|
+
if (!bounds.intersects(Bounds.fromJson(img.bounds)))
|
|
50
57
|
continue;
|
|
51
58
|
for (const c of img.files) {
|
|
52
|
-
if (!
|
|
59
|
+
if (!bounds.intersects(Bounds.fromJson(c)))
|
|
53
60
|
continue;
|
|
54
|
-
|
|
61
|
+
// If there are overviews and they exist for this zoom range and we are not ignoring them
|
|
62
|
+
// lets use the overviews instead!
|
|
63
|
+
if (img.overviews &&
|
|
64
|
+
img.overviews.maxZoom >= filterZoom &&
|
|
65
|
+
img.overviews.minZoom <= filterZoom &&
|
|
66
|
+
ignoreOverview !== true) {
|
|
55
67
|
output.push(fsa.join(img.uri, img.overviews.path));
|
|
56
68
|
break;
|
|
57
69
|
}
|
|
@@ -61,16 +73,9 @@ export const TileXyzRaster = {
|
|
|
61
73
|
}
|
|
62
74
|
return output;
|
|
63
75
|
},
|
|
64
|
-
async
|
|
65
|
-
var _a, _b;
|
|
66
|
-
if (xyz.tileType === VectorFormat.MapboxVectorTiles)
|
|
67
|
-
return NotFound();
|
|
68
|
-
const assetPaths = await this.getAssetsForTile(req, tileSet, xyz);
|
|
69
|
-
const cacheKey = Etag.key(assetPaths);
|
|
70
|
-
if (Etag.isNotModified(req, cacheKey))
|
|
71
|
-
return NotModified();
|
|
76
|
+
async loadAssets(req, assets) {
|
|
72
77
|
const toLoad = [];
|
|
73
|
-
for (const assetPath of
|
|
78
|
+
for (const assetPath of assets) {
|
|
74
79
|
toLoad.push(LoadingQueue(() => {
|
|
75
80
|
if (assetPath.endsWith('.tar.co')) {
|
|
76
81
|
return CoSources.getCotar(assetPath).catch((error) => {
|
|
@@ -84,7 +89,21 @@ export const TileXyzRaster = {
|
|
|
84
89
|
});
|
|
85
90
|
}));
|
|
86
91
|
}
|
|
87
|
-
|
|
92
|
+
return (await Promise.all(toLoad)).filter((f) => f != null);
|
|
93
|
+
},
|
|
94
|
+
async getAssetsForTile(req, tileSet, xyz) {
|
|
95
|
+
const tileBounds = xyz.tileMatrix.tileToSourceBounds(xyz.tile);
|
|
96
|
+
return TileXyzRaster.getAssetsForBounds(req, tileSet, xyz.tileMatrix, tileBounds, xyz.tile.z);
|
|
97
|
+
},
|
|
98
|
+
async tile(req, tileSet, xyz) {
|
|
99
|
+
var _a, _b;
|
|
100
|
+
if (xyz.tileType === VectorFormat.MapboxVectorTiles)
|
|
101
|
+
return NotFound();
|
|
102
|
+
const assetPaths = await this.getAssetsForTile(req, tileSet, xyz);
|
|
103
|
+
const cacheKey = Etag.key(assetPaths);
|
|
104
|
+
if (Etag.isNotModified(req, cacheKey))
|
|
105
|
+
return NotModified();
|
|
106
|
+
const assets = await TileXyzRaster.loadAssets(req, assetPaths);
|
|
88
107
|
const tiler = new Tiler(xyz.tileMatrix);
|
|
89
108
|
const layers = await tiler.tile(assets, xyz.tile.x, xyz.tile.y, xyz.tile.z);
|
|
90
109
|
const res = await TileComposer.compose({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile.xyz.raster.js","sourceRoot":"","sources":["../../src/routes/tile.xyz.raster.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAuB,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,cAAc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OAAO,CAAC,YAAY,mCAAI,mBAAmB;YACzD,OAAO,EAAE,GAAG,CAAC,KAAK;SACnB,CAAC,CAAC;QAEH,GAAG,CAAC,GAAG,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QAClC,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAExC,MAAM,QAAQ,GAAG,IAAI,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACnD,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC3C,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,EAAE,sDAAsD,CAAC,CAAC;QACjG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC;QACrD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/routes/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEhE,wBAAsB,UAAU,IAAI,OAAO,CAAC,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/routes/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEhE,wBAAsB,UAAU,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAqB9D"}
|
package/build/routes/version.js
CHANGED
|
@@ -3,7 +3,23 @@ export async function versionGet() {
|
|
|
3
3
|
var _a;
|
|
4
4
|
const response = new LambdaHttpResponse(200, 'ok');
|
|
5
5
|
response.header(HttpHeader.CacheControl, 'no-store');
|
|
6
|
-
response.json({
|
|
6
|
+
response.json({
|
|
7
|
+
/**
|
|
8
|
+
* last git version tag
|
|
9
|
+
* @example "v6.42.1"
|
|
10
|
+
*/
|
|
11
|
+
version: (_a = process.env.GIT_VERSION) !== null && _a !== void 0 ? _a : 'dev',
|
|
12
|
+
/**
|
|
13
|
+
* Full git commit hash
|
|
14
|
+
* @example "e4231b1ee62c276c8657c56677ced02681dfe5d6"
|
|
15
|
+
*/
|
|
16
|
+
hash: process.env.GIT_HASH,
|
|
17
|
+
/**
|
|
18
|
+
* The exact build that this release was run from
|
|
19
|
+
* @example "1658821493-3"
|
|
20
|
+
*/
|
|
21
|
+
buildId: process.env.BUILD_ID,
|
|
22
|
+
});
|
|
7
23
|
return response;
|
|
8
24
|
}
|
|
9
25
|
//# sourceMappingURL=version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/routes/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEhE,MAAM,CAAC,KAAK,UAAU,UAAU;;IAC9B,MAAM,QAAQ,GAAG,IAAI,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACnD,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IACrD,QAAQ,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/routes/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEhE,MAAM,CAAC,KAAK,UAAU,UAAU;;IAC9B,MAAM,QAAQ,GAAG,IAAI,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACnD,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IACrD,QAAQ,CAAC,IAAI,CAAC;QACZ;;;WAGG;QACH,OAAO,EAAE,MAAA,OAAO,CAAC,GAAG,CAAC,WAAW,mCAAI,KAAK;QACzC;;;WAGG;QACH,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ;QAC1B;;;WAGG;QACH,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ;KAC9B,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/build/util/validate.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ImageFormat, TileMatrixSet, VectorFormat } from '@basemaps/geo';
|
|
1
|
+
import { ImageFormat, LatLon, TileMatrixSet, VectorFormat } from '@basemaps/geo';
|
|
2
2
|
import { LambdaHttpRequest } from '@linzjs/lambda';
|
|
3
3
|
import { TileXyzGet } from '../routes/tile.xyz';
|
|
4
4
|
export interface TileXyz {
|
|
@@ -26,6 +26,8 @@ export declare const Validate: {
|
|
|
26
26
|
/** Read in all image formats specified in the query parameters "format" or "tileFormat" */
|
|
27
27
|
getRequestedFormats(req: LambdaHttpRequest): ImageFormat[] | null;
|
|
28
28
|
getTileFormat(tileType: string): ImageFormat | VectorFormat | null;
|
|
29
|
+
/** Validate that a lat and lon are between -90/90 and -180/180 */
|
|
30
|
+
getLocation(lonIn: string, latIn: string): LatLon | null;
|
|
29
31
|
/**
|
|
30
32
|
* Validate that the tile request is somewhat valid
|
|
31
33
|
* - Valid projection
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/util/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,aAAa,EAAkB,YAAY,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/util/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAc,aAAa,EAAkB,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7G,OAAO,EAAE,iBAAiB,EAAsB,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,aAAa,CAAC;IAC1B,QAAQ,EAAE,YAAY,GAAG,WAAW,CAAC;CACtC;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACjC;AAED,eAAO,MAAM,QAAQ;IACnB;;;OAGG;gBACS,iBAAiB,GAAG,MAAM;2BAUf,MAAM,GAAG,aAAa,GAAG,IAAI;IAIpD,2FAA2F;6BAClE,iBAAiB,GAAG,WAAW,EAAE,GAAG,IAAI;4BAczC,MAAM,GAAG,WAAW,GAAG,YAAY,GAAG,IAAI;IAOlE,kEAAkE;uBAC/C,MAAM,SAAS,MAAM,GAAG,MAAM,GAAG,IAAI;IAOxD;;;;;;;;;OASG;aACM,kBAAkB,UAAU,CAAC,GAAG,OAAO;CAiCjD,CAAC"}
|
package/build/util/validate.js
CHANGED
|
@@ -44,6 +44,16 @@ export const Validate = {
|
|
|
44
44
|
return VectorFormat.MapboxVectorTiles;
|
|
45
45
|
return null;
|
|
46
46
|
},
|
|
47
|
+
/** Validate that a lat and lon are between -90/90 and -180/180 */
|
|
48
|
+
getLocation(lonIn, latIn) {
|
|
49
|
+
const lat = parseFloat(latIn);
|
|
50
|
+
const lon = parseFloat(lonIn);
|
|
51
|
+
if (isNaN(lon) || lon < -180 || lon > 180)
|
|
52
|
+
return null;
|
|
53
|
+
if (isNaN(lat) || lat < -90 || lat > 90)
|
|
54
|
+
return null;
|
|
55
|
+
return { lon, lat };
|
|
56
|
+
},
|
|
47
57
|
/**
|
|
48
58
|
* Validate that the tile request is somewhat valid
|
|
49
59
|
* - Valid projection
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/util/validate.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/util/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,UAAU,EAAiB,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAqB,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAcvE,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB;;;OAGG;IACH,MAAM,CAAC,GAAsB;;QAC3B,MAAM,MAAM,GAAG,MAAA,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,mCAAI,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QACvF,MAAM,KAAK,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;QAEpC,IAAI,CAAC,KAAK,CAAC,KAAK;YAAE,MAAM,IAAI,kBAAkB,CAAC,GAAG,EAAE,mBAAmB,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;QACzF,0DAA0D;QAC1D,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;QACvC,OAAO,MAAgB,CAAC;IAC1B,CAAC;IAED,gBAAgB,CAAC,GAAY;QAC3B,OAAO,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,2FAA2F;IAC3F,mBAAmB,CAAC,GAAsB;QACxC,MAAM,OAAO,GAAG,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAA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AAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjC,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,WAAW;YAAE,MAAM,IAAI,kBAAkB,CAAC,GAAG,EAAE,gBAAgB,CAAC,EAAE,CAAC,CAAC;QACtG,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,YAAY;YAAE,MAAM,IAAI,kBAAkB,CAAC,GAAG,EAAE,gBAAgB,CAAC,EAAE,CAAC,CAAC;QAEvG,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;QACzF,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAE7B,MAAM,MAAM,GAAG,UAAU,CAAC,kBAAkB,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACvE,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAE5B,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC"}
|
package/bundle.sh
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basemaps/lambda-tiler",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.44.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/linz/basemaps.git",
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
"types": "./build/index.d.ts",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@basemaps/config": "^6.
|
|
26
|
-
"@basemaps/geo": "^6.
|
|
27
|
-
"@basemaps/shared": "^6.
|
|
28
|
-
"@basemaps/tiler": "^6.
|
|
29
|
-
"@basemaps/tiler-sharp": "^6.
|
|
25
|
+
"@basemaps/config": "^6.44.0",
|
|
26
|
+
"@basemaps/geo": "^6.44.0",
|
|
27
|
+
"@basemaps/shared": "^6.44.0",
|
|
28
|
+
"@basemaps/tiler": "^6.44.0",
|
|
29
|
+
"@basemaps/tiler-sharp": "^6.44.0",
|
|
30
30
|
"@chunkd/fs": "^10.0.2",
|
|
31
31
|
"@cogeotiff/core": "^7.2.0",
|
|
32
32
|
"@cotar/core": "^5.4.0",
|
|
33
|
-
"@linzjs/geojson": "^6.
|
|
33
|
+
"@linzjs/geojson": "^6.43.0",
|
|
34
34
|
"@linzjs/lambda": "^4.0.0",
|
|
35
35
|
"p-limit": "^4.0.0",
|
|
36
36
|
"path-to-regexp": "^6.1.0",
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
"bundle": "./bundle.sh"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@basemaps/attribution": "^6.
|
|
53
|
+
"@basemaps/attribution": "^6.44.0",
|
|
54
54
|
"@chunkd/source-memory": "^10.0.0",
|
|
55
55
|
"@types/aws-lambda": "^8.10.75",
|
|
56
56
|
"@types/pixelmatch": "^5.0.0",
|
|
57
57
|
"@types/sharp": "^0.30.3",
|
|
58
58
|
"pretty-json-log": "^1.0.0"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "025cc55d4e11c7e527ba2aec2f7655489be8d035"
|
|
61
61
|
}
|
|
@@ -9,11 +9,10 @@ o.spec('LambdaXyz index', () => {
|
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
o.spec('version', () => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
process.env.
|
|
16
|
-
process.env.GIT_HASH = origHash;
|
|
12
|
+
o.afterEach(() => {
|
|
13
|
+
delete process.env.GIT_VERSION;
|
|
14
|
+
delete process.env.GIT_HASH;
|
|
15
|
+
delete process.env.BUILD_ID;
|
|
17
16
|
});
|
|
18
17
|
|
|
19
18
|
o('should return version', async () => {
|
|
@@ -30,6 +29,22 @@ o.spec('LambdaXyz index', () => {
|
|
|
30
29
|
hash: 'abc456',
|
|
31
30
|
});
|
|
32
31
|
});
|
|
32
|
+
|
|
33
|
+
o('should include buildId if exists', async () => {
|
|
34
|
+
process.env.GIT_VERSION = '1.2.3';
|
|
35
|
+
process.env.BUILD_ID = '1658821493-3';
|
|
36
|
+
|
|
37
|
+
const response = await handler.router.handle(mockRequest('/v1/version'));
|
|
38
|
+
|
|
39
|
+
const body = JSON.parse(response.body as string);
|
|
40
|
+
o(response.status).equals(200);
|
|
41
|
+
o(response.statusDescription).equals('ok');
|
|
42
|
+
o(response.header('cache-control')).equals('no-store');
|
|
43
|
+
o(body).deepEquals({
|
|
44
|
+
version: '1.2.3',
|
|
45
|
+
buildId: '1658821493-3',
|
|
46
|
+
});
|
|
47
|
+
});
|
|
33
48
|
});
|
|
34
49
|
|
|
35
50
|
o('should respond to /ping', async () => {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ConfigProviderMemory } from '@basemaps/config';
|
|
2
|
+
import { initConfigFromUrls } from '@basemaps/config/build/json/tiff.config.js';
|
|
3
|
+
import { ImageFormat, TileMatrixSet, TileMatrixSets } from '@basemaps/geo';
|
|
4
|
+
import { LogConfig, setDefaultConfig } from '@basemaps/shared';
|
|
5
|
+
import { fsa } from '@chunkd/fs';
|
|
6
|
+
import { LambdaHttpRequest, LambdaUrlRequest, UrlEvent } from '@linzjs/lambda';
|
|
7
|
+
import { Context } from 'aws-lambda';
|
|
8
|
+
import { pathToFileURL } from 'url';
|
|
9
|
+
import { renderPreview } from '../routes/preview.js';
|
|
10
|
+
|
|
11
|
+
const target = pathToFileURL(`/home/blacha/tmp/basemaps/bm-724/test-north-island_20230220_10m/`);
|
|
12
|
+
const location = { lat: -39.0852555, lon: 177.3998405 };
|
|
13
|
+
const z = 12;
|
|
14
|
+
|
|
15
|
+
const outputFormat = ImageFormat.Webp;
|
|
16
|
+
let tileMatrix: TileMatrixSet | null = null;
|
|
17
|
+
|
|
18
|
+
async function main(): Promise<void> {
|
|
19
|
+
const log = LogConfig.get();
|
|
20
|
+
const provider = new ConfigProviderMemory();
|
|
21
|
+
setDefaultConfig(provider);
|
|
22
|
+
const { tileSet, imagery } = await initConfigFromUrls(provider, [target]);
|
|
23
|
+
|
|
24
|
+
if (tileSet.layers.length === 0) throw new Error('No imagery found in path: ' + target);
|
|
25
|
+
log.info({ tileSet: tileSet.name, layers: tileSet.layers.length }, 'TileSet:Loaded');
|
|
26
|
+
|
|
27
|
+
for (const im of imagery) {
|
|
28
|
+
log.info({ url: im.uri, title: im.title, tileMatrix: im.tileMatrix, files: im.files.length }, 'Imagery:Loaded');
|
|
29
|
+
if (tileMatrix == null) {
|
|
30
|
+
tileMatrix = TileMatrixSets.find(im.tileMatrix);
|
|
31
|
+
log.info({ tileMatrix: im.tileMatrix }, 'Imagery:TileMatrix:Set');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (tileMatrix == null) throw new Error('No tileMatrix found');
|
|
36
|
+
|
|
37
|
+
const req = new LambdaUrlRequest({ headers: {} } as UrlEvent, {} as Context, LogConfig.get()) as LambdaHttpRequest;
|
|
38
|
+
const res = await renderPreview(req, { tileMatrix, tileSet, location, z, outputFormat });
|
|
39
|
+
const previewFile = `./z${z}_${location.lon}_${location.lat}.${outputFormat}`;
|
|
40
|
+
await fsa.write(previewFile, Buffer.from(res.body, 'base64'));
|
|
41
|
+
log.info({ path: previewFile }, 'Tile:Write');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
main();
|