@watergis/terrain-rgb
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

terrain-rgb

GitHub

This module is to get elevation from terrain RGB tilesets by longitude and latitude.

Install

npm i @watergis/terrain-rgb

demo

code sandbox

Usage

This module can be used for PNG or WEBP terrain RGB tilesets.

import {TerrainRGB} from '@watergis/terrain-rgb';

const url = 'https://wasac.github.io/rw-terrain/tiles/{z}/{x}/{y}.png';
const trgb = new TerrainRGB(url, 512);

const elevation = await trgb.getElevation([30.0529622, -1.9575129], 15);
console.log(elevation);

TMS(Tile Map Service) tiles are also supported with

const trgb = new TerrainRGB(url, 512, 5, 15, true);

If it can't find tile, it will return 404 error.

If its terrain RGB tilesets was resampled by gdal2tiles, the result of elevation might not be the same with original DEM image.

/@watergis/terrain-rgb/

    Package Sidebar

    Install

    npm i @watergis/terrain-rgb

    Weekly Downloads

    41

    Version

    1.2.0

    License

    MIT

    Unpacked Size

    101 kB

    Total Files

    35

    Last publish

    Collaborators

    • j_igarashi