Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@loaders.gl/terrain

Package Overview
Dependencies
Maintainers
9
Versions
270
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loaders.gl/terrain

Framework-independent loader for terrain raster formats

  • 4.2.0-alpha.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
166K
increased by2.64%
Maintainers
9
Weekly downloads
 
Created

What is @loaders.gl/terrain?

@loaders.gl/terrain is a module within the loaders.gl suite that provides tools for loading and parsing terrain data. It supports various terrain formats and can be used to integrate terrain data into web applications, particularly those involving 3D visualization and geographic information systems (GIS).

What are @loaders.gl/terrain's main functionalities?

Loading Terrain Data

This feature allows you to load terrain data from a specified URL using the TerrainLoader. The loaded data can then be used for further processing or visualization.

const {TerrainLoader} = require('@loaders.gl/terrain');
const {load} = require('@loaders.gl/core');

async function loadTerrain(url) {
  const terrainData = await load(url, TerrainLoader);
  console.log(terrainData);
}

loadTerrain('https://example.com/terrain-data.terrain');

Parsing Terrain Data

This feature allows you to parse terrain data from an ArrayBuffer. This is useful when you have raw terrain data that needs to be converted into a usable format.

const {TerrainLoader} = require('@loaders.gl/terrain');
const {parse} = require('@loaders.gl/core');

async function parseTerrain(arrayBuffer) {
  const terrainData = await parse(arrayBuffer, TerrainLoader);
  console.log(terrainData);
}

// Assuming arrayBuffer is obtained from a file or network request
parseTerrain(arrayBuffer);

Integrating with 3D Visualization Libraries

This feature demonstrates how to integrate loaded terrain data with a 3D visualization library like Cesium. The example shows how to add a terrain model to a Cesium viewer.

const {TerrainLoader} = require('@loaders.gl/terrain');
const {load} = require('@loaders.gl/core');
const {Viewer, Entity} = require('cesium');

async function addTerrainToCesium(viewer, url) {
  const terrainData = await load(url, TerrainLoader);
  viewer.entities.add(new Entity({
    position: Cesium.Cartesian3.fromDegrees(terrainData.longitude, terrainData.latitude),
    model: {
      uri: terrainData.modelUrl
    }
  }));
}

const viewer = new Viewer('cesiumContainer');
addTerrainToCesium(viewer, 'https://example.com/terrain-data.terrain');

Other packages similar to @loaders.gl/terrain

Keywords

FAQs

Package last updated on 26 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc